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 PeGlTrans('search');
     //$model->unsetAttributes();
     $criteria = new CDbCriteria();
     //$criteria->limit = $limit;
     //$criteria->offset = $start;
     $model = PeGlTrans::model()->findAll($criteria);
     $total = PeGlTrans::model()->count($criteria);
     if (isset($_GET['PeGlTrans'])) {
         $model->attributes = $_GET['PeGlTrans'];
     }
     if (isset($_GET['output']) && $_GET['output'] == 'json') {
         $this->renderJson($model, $total);
     } else {
         $model = new PeGlTrans('search');
         $model->unsetAttributes();
         $this->render('admin', array('model' => $model));
     }
 }
Example #2
0
 static function account_in_gl_trans($account)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("account = '{$account}'");
     $count = PeGlTrans::model()->count($criteria);
     return $count > 0;
 }