Although pagination will help our restaurant critics to navigate through the records in consistent chunks, sometimes they will have a specific review in mind or will want to narrow down the display to a certain set of reviews. Adding search capabilities to our component will help the reviewers find specific reviews quickly. The changes that were made to the all
model for pagination will make adding the search feature a little easier.
The model will now need to keep track of the search term for multiple calls. Also, as the query will no longer be a static string, this should be cached as well. Add the following private variables to the all
model:
var $_total = null;
var $_search = null;
var $_query = null;
Next, the model will need a function that prepares the search term and returns it. This function needs to do three things get the search term from the session (rather than the request), set it to lowercase, and store it in the $_search
member variable. Add...