コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new WHistoryLog();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['WHistoryLog'])) {
         $model->attributes = $_POST['WHistoryLog'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
 public static function insertHistoryLog($action, $component, $event_name)
 {
     $model = new WHistoryLog();
     $model->user_id = Yii::app()->user->id;
     $model->action = $action;
     $model->log_time = time();
     $model->group_id = Yii::app()->session['group_id'];
     $model->ip = $_SERVER['REMOTE_ADDR'];
     $model->component = $component;
     $model->event_name = $event_name;
     if ($model->save()) {
         return true;
     } else {
         return false;
     }
 }