On Nov 15, 1:46 pm, "mike091" <[EMAIL PROTECTED]> wrote:
> Hi all,
> Wondering if you can help me on a small problem. I am using simple
> Pagination to display all records in my Enquiry table where status =
> 'new'. However I want to be able to let the user change this where
> clause in the view from 'new' something like 'pending'. Can you advise
> me as to the simplest way of doing this?
>
> This is part of what I currently have in my controller...
> $status = "new";
> $data = $this->{$this->modelClass}->findAll("Enquiry.status='$status'",
> NULL, $order, $limit, $page);
>
> Thanks very much,
>
> Bill
Easiest way is something like:
function index($status ='new') {
if (!in_array($status, array('new','pending','otherLegalValue')) {
$status = 'new';
}
$constraint['Enquiry.status'] = $status;
$this->Pagination->init($constraint);... etc.
}
Then just use a link (or a redirect if it's aform submission) to direct
to /index/new /index/pending /index/closed etc.
HTH,
AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :)
You may get your answer quicker by asking on the IRC Channel (you can
access it with just a browser here: http://irc.cakephp.org).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---