Пример #1
0
 public static function getHistoryLog()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'group_id=:group_id and user_id=:user_id';
     $criteria->params = array(':group_id' => Yii::app()->session['group_id'], ':user_id' => Yii::app()->user->id);
     $criteria->order = 'log_time DESC';
     $rs = WHistoryLog::model()->findAll($criteria);
     if ($rs) {
         return $rs;
     } else {
         return null;
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return WHistoryLog the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = WHistoryLog::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }