本文整理汇总了PHP中Note::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::search方法的具体用法?PHP Note::search怎么用?PHP Note::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Lists all notes.
*/
public function actionIndex()
{
$model = new Note('search');
if (isset($_GET['Note'])) {
$model->attributes = $_GET['Note'];
$dataProvider = $model->search();
} else {
$dataProvider = new CActiveDataProvider('Note', array('criteria' => array('order' => 'upload_timestamp DESC')));
}
$dataProvider->setPagination(array('pageSize' => 16));
$students = Student::model()->findAll();
$usernames = array();
foreach ($students as $student) {
$usernames[] = $student->username;
}
$this->render('index', array('model' => $model, 'dataProvider' => $dataProvider, 'usernames' => $usernames));
}
示例2: testSearch
/**
* Tests search action.
*/
public function testSearch()
{
// search by title
$note = new Note();
$note->title = '1';
$this->assertEquals(1, $note->search()->totalItemCount);
// search by type
$note = new Note();
$note->type = 0;
$this->assertEquals(1, $note->search()->totalItemCount);
// search by faculty
$note = new Note();
$note->faculty_id = 1;
$this->assertEquals(2, $note->search()->totalItemCount);
// search by course
$note = new Note();
$note->course_id = 1;
$this->assertEquals(1, $note->search()->totalItemCount);
// search by uploader
$note = new Note();
$note->uploader = '1';
$this->assertEquals(2, $note->search()->totalItemCount);
}
示例3: search_notes
function search_notes()
{
$data = array('title' => 'Search' . ($search ? ": {$search}" : ''), 'results' => Note::search(rtrim($_GET['search'])));
echo template('search_template', $data, 'layout');
}