本文整理匯總了PHP中SearchForm::apllyFilter方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchForm::apllyFilter方法的具體用法?PHP SearchForm::apllyFilter怎麽用?PHP SearchForm::apllyFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SearchForm
的用法示例。
在下文中一共展示了SearchForm::apllyFilter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionList
/**
* Show all books.
*/
public function actionList()
{
$criteria = new CDbCriteria();
$criteria->with = 'author';
$searchForm = new SearchForm();
if (isset($_POST['SearchForm'])) {
$searchForm->setAttributes($_POST['SearchForm']);
$criteria = $searchForm->apllyFilter($criteria);
}
$pages = new CPagination(Books::model()->count());
$pages->applyLimit($criteria);
$sort = new CSort('Books');
$sort->attributes = array('name', 'date', 'date_update', 'author' => array('asc' => 'author.lastname, author.firstname', 'desc' => 'author.lastname DESC, author.firstname DESC', 'label' => 'Автор'));
$sort->defaultOrder = 'name';
$sort->applyOrder($criteria);
$books = Books::model()->findAll($criteria);
$formWidget = $this->createWidget('FormWindow');
$formWidget->afterClose = '$("#ui-datepicker-div").remove();$("#content").load("#");';
$formWidget->run();
$this->renderAjax('list', array('pages' => $pages, 'models' => $books, 'sort' => $sort, 'searchForm' => $searchForm));
}