コード例 #1
0
 public function actionAdminSearch()
 {
     $this->layout = '//layouts/blank';
     $model = new Advertisement('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Advertisement'])) {
         $model->attributes = $_GET['Advertisement'];
     }
     $criteria = $model->search()->getCriteria();
     $criteria->order = 'id DESC';
     $count = Advertisement::model()->count($criteria);
     $pagination = new CPagination($count);
     $pagination->setPageSize(15);
     $pagination->applyLimit($criteria);
     $dataProvider = Advertisement::model()->findAll($criteria);
     $this->render('adminsearch', array('dataProvider' => $dataProvider, 'pagination' => $pagination));
 }