Ejemplo n.º 1
0
 /**
  * @test
  */
 public function search()
 {
     // recherche par nom
     $model = new NewsCategory('search');
     $model->unsetAttributes();
     $model->name = "1";
     $data = $model->search()->data;
     $this->assertEquals(1, count($data));
     $model->unsetAttributes();
     $model->name = 'at';
     $data = $model->search()->data;
     $this->assertEquals(3, count($data));
 }
Ejemplo n.º 2
0
 public function actionIndex()
 {
     $model = new NewsCategory('search');
     $model->unsetAttributes();
     if (isset($_GET['NewsCategory'])) {
         $model->attributes = $_GET['NewsCategory'];
     }
     $this->render('index', array('model' => $model));
 }
Ejemplo n.º 3
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new NewsCategory('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['NewsCategory'])) {
         $model->attributes = $_GET['NewsCategory'];
     }
     $this->render('admin', array('model' => $model));
 }
Ejemplo n.º 4
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $session = $this->setAdminGridViewSessionVariables('NewsCategory');
     $model = new NewsCategory('search');
     $model->unsetAttributes();
     // clear any default values
     $model->attributes = $session->get('admin_current_filter');
     $pager = new CPagination();
     $pager->pageSize = Yii::app()->getModule('news')->adminPageSize;
     if ($page = $session->get('admin_current_page')) {
         $pager->currentPage = $page - 1;
         // la numérotation commence à 0...
     }
     $this->render('admin', array('model' => $model, 'pager' => $pager));
 }