コード例 #1
0
 public function actionIndex()
 {
     $model = new tAccount('search');
     $model->unsetAttributes();
     $criteria = new CDbCriteria();
     if (isset($_GET['tAccount'])) {
         $model->attributes = $_GET['tAccount'];
         $criteria->compare('account_name', $_GET['tAccount']['account_name'], true);
     }
     $criteria->order = 'account_no';
     $total = tAccount::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = 20;
     $pages->applyLimit($criteria);
     $dataProvider = tAccount::model()->findAll($criteria);
     $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model, 'pages' => $pages));
 }