Example #1
0
 static function account_in_gl_trans($account)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("account = '{$account}'");
     $count = MtGlTrans::model()->count($criteria);
     return $count > 0;
 }
 public function actionIndex()
 {
     if (isset($_POST['limit'])) {
         $limit = $_POST['limit'];
     } else {
         $limit = 20;
     }
     if (isset($_POST['start'])) {
         $start = $_POST['start'];
     } else {
         $start = 0;
     }
     //$model = new MtGlTrans('search');
     //$model->unsetAttributes();
     $criteria = new CDbCriteria();
     //        $criteria->limit = $limit;
     //        $criteria->offset = $start;
     $model = MtGlTrans::model()->findAll($criteria);
     $total = MtGlTrans::model()->count($criteria);
     if (isset($_GET['MtGlTrans'])) {
         $model->attributes = $_GET['MtGlTrans'];
     }
     if (isset($_GET['output']) && $_GET['output'] == 'json') {
         $this->renderJson($model, $total);
     } else {
         $model = new MtGlTrans('search');
         $model->unsetAttributes();
         $this->render('admin', array('model' => $model));
     }
 }