/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new ViciLogAction();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ViciLogAction'])) {
         $model->attributes = $_POST['ViciLogAction'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public static function logAction($actionType, $message, $topUpValue, $batch, $logDate)
 {
     if (empty($batch) || is_null($batch)) {
         $batch = uniqid();
     }
     if (empty($logDate) || is_null($logDate)) {
         $logDate = time();
     }
     $newRecod = new ViciLogAction();
     $newRecod->action_type = $actionType;
     $newRecod->message = $message;
     $newRecod->topUpValue = $topUpValue;
     $newRecod->batch = $batch;
     $newRecod->logDate = $logDate;
     if (!$newRecod->save()) {
         throw new Exception("Cant save log due to : " . CHtml::errorSummary($newRecod));
     }
 }