当前位置: 首页>>代码示例>>PHP>>正文


PHP Note::search方法代码示例

本文整理汇总了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));
 }
开发者ID:ekospinach,项目名称:berkuliah,代码行数:20,代码来源:HomeController.php

示例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);
 }
开发者ID:ekospinach,项目名称:berkuliah,代码行数:26,代码来源:NoteTest.php

示例3: search_notes

function search_notes()
{
    $data = array('title' => 'Search' . ($search ? ": {$search}" : ''), 'results' => Note::search(rtrim($_GET['search'])));
    echo template('search_template', $data, 'layout');
}
开发者ID:jcartledge,项目名称:notes,代码行数:5,代码来源:index.php


注:本文中的Note::search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。