예제 #1
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->created = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $this->created = date('Y-m-d H:i:s');
         }
         $this->updated = date('Y-m-d H:i:s');
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $this->forwarded_slave_created = new CDbExpression('NOW()');
         }
         $this->forwarded_slave_updated = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
예제 #4
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->created = new CDbExpression('NOW()');
     }
     $this->updated = new CDbExpression('NOW()');
     if ($this->pass != '') {
         $this->password = CPasswordHelper::hashPassword($this->pass);
     }
     return parent::beforeSave();
 }
예제 #5
0
 public function beforeSave()
 {
     if (!$this->getUseLong() && $this->beforeSave) {
         if ($this->isNewRecord) {
             $this->created = new CDbExpression('NOW()');
         }
         $this->timezone_offset = TimezoneWork::getOffsetFromUTC($this->timezone_id, 1);
         $this->updated = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
예제 #6
0
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $this->created = new CDbExpression('NOW()');
         }
         $this->updated = new CDbExpression('NOW()');
         //
         // SPECI report is not auto-generated.
         // It is generated by user request, not by schedule.
         if ($this->report_type == 'speci') {
             $this->period = 0;
         }
     }
     return parent::beforeSave();
 }
예제 #7
0
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $this->created = new CDbExpression('NOW()');
             $this->setTimes();
         }
         $this->updated = new CDbExpression('NOW()');
         if ($this->parse_time && !empty($this->start_time) && !empty($this->start_date)) {
             preg_match("/^([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})\$/", $this->start_date, $start_date_matches);
             preg_match("/^(\\d{1,2})\\/(\\d{1,2})\$/", $this->start_time, $start_time_matches);
             $this->next_run_planned = $start_date_matches[3] . '-' . $start_date_matches[1] . '-' . $start_date_matches[2] . ' ' . $start_time_matches[1] . ':' . $start_time_matches[2] . ':' . '00';
             $this->start_datetime = date('Y-m-d H:i:s', It::timeToUnixTimestamp($this->next_run_planned) - $this->period * 60);
         }
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $this->created = new CDbExpression('NOW()');
         }
         $this->updated = new CDbExpression('NOW()');
         $synchronization = new Synchronization();
         if ($synchronization->isProcessed()) {
             if ($synchronization->isMaster()) {
                 $this->current_role = 'master';
             } else {
                 $this->current_role = 'slave';
             }
         }
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     if (!$this->getUseLong()) {
         if ($this->isNewRecord) {
             $sql = "UPDATE `" . ScheduleReportProcessed::model()->tableName() . "` SET `is_last` = 0\n                         WHERE `sr_to_s_id` = '" . $this->sr_to_s_id . "'\n                         AND `is_last` = '1' ";
             Yii::app()->db->createCommand($sql)->query();
             $this->created = new CDbExpression('NOW()');
             $this->is_last = 1;
             $this->is_processed = 0;
         } else {
             if ($this->is_processed === 1) {
                 $sql = "SELECT `is_processed`\n                            FROM `" . ScheduleReportProcessed::model()->tableName() . "`\n                            WHERE `schedule_processed_id` = ?";
                 $res = Yii::app()->db->createCommand($sql)->queryScalar(array($this->schedule_processed_id));
                 if ($res == 0) {
                     $sql = "UPDATE `" . ScheduleReportProcessed::model()->tableName() . "` SET `is_last` = 0\n                         WHERE `sr_to_s_id` = '" . $this->sr_to_s_id . "'\n                         AND `is_last` = '1' ";
                     Yii::app()->db->createCommand($sql)->query();
                     $this->is_last = 1;
                 }
             }
         }
         $this->updated = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
예제 #10
0
 public function beforeSave()
 {
     $this->local_timezone_offset = TimezoneWork::getOffsetFromUTC($this->local_timezone_id, 1);
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     return parent::beforeSave();
 }