Exemple #1
0
 /**
  * Generates a unique token before save
  *
  * @return type
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->token = uniqid() . mt_rand();
     }
     return parent::beforeSave();
 }
Exemple #2
0
 public function beforeSave()
 {
     if ($this->type == self::TYPE_IFRAME || $this->type == self::TYPE_LINK) {
         $this->content = $this->url;
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     if ($this->room_id == "") {
         $this->room_id = 0;
     }
     Yii::app()->cache->delete(self::STATES_CACHE_ID_PREFIX . $this->room_id);
     return parent::beforeSave();
 }
Exemple #4
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         // Updates the updated_at attribute
         $this->message->save();
     }
     return parent::beforeSave();
 }
Exemple #5
0
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         // ToDo: Handle this via event of User Module
         if ($this->object_model == 'User') {
             // Create Wall Activity for that
             $activity = new Activity();
             $activity->content->user_id = $this->user->id;
             $activity->content->visibility = Content::VISIBILITY_PUBLIC;
             $activity->type = "ActivityUserFollowsUser";
             $activity->object_model = "User";
             $activity->object_id = $this->object_id;
             $activity->save();
             $activity->content->addToWall($this->user->wall_id);
         }
     }
     return parent::beforeSave();
 }
Exemple #6
0
 public function beforeSave()
 {
     // When on edit form scenario, save also defaultSpaceGuid/adminGuids
     if ($this->scenario == 'edit') {
         if ($this->defaultSpaceGuid == "") {
             $this->space_id = "";
         } else {
             $space = Space::model()->findByAttributes(array('guid' => rtrim($this->defaultSpaceGuid, ',')));
             if ($space !== null) {
                 $this->space_id = $space->id;
             }
         }
     }
     return parent::beforeSave();
 }
Exemple #7
0
 public function beforeSave()
 {
     Yii::app()->cache->delete($this->getCacheId());
     RuntimeCache::Remove($this->getCacheId());
     return parent::beforeSave();
 }
Exemple #8
0
 protected function beforeSave()
 {
     $this->sanitizeFilename();
     if ($this->title == "") {
         $this->title = $this->file_name;
     }
     return parent::beforeSave();
 }
Exemple #9
0
 public function beforeSave()
 {
     foreach ($this->attributes as $key => $value) {
         if ($value == "") {
             $this->{$key} = NULL;
         }
     }
     return parent::beforeSave();
 }
 /**
  * Before saving this record.
  *
  * @return type
  */
 protected function beforeSave()
 {
     Yii::app()->cache->delete('userSpaces_' . $this->user_id);
     return parent::beforeSave();
 }
Exemple #11
0
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if ($this->seen == "") {
             $this->seen = 0;
         }
     }
     return parent::beforeSave();
 }
Exemple #12
0
 public function beforeSave()
 {
     $this->clearCache();
     if ($this->module_id === "") {
         $this->module_id = new CDbExpression('NULL');
     }
     if ($this->hasAttribute('created_by') && empty($this->created_by)) {
         $this->created_by = 0;
     }
     if ($this->hasAttribute('updated_by') && empty($this->updated_by)) {
         $this->updated_by = 0;
     }
     if ($this->hasAttribute('updated_at') && empty($this->updated_at)) {
         $this->updated_at = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     $this->is_latest = 1;
     return parent::beforeSave();
 }
Exemple #14
0
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if ($this->seen == "") {
             $this->seen = 0;
         }
     }
     $userOnline = UserHttpSession::model()->exists('user_id = ' . $this->user_id);
     if (!$userOnline) {
         $this->desktop_notified = 1;
     }
     return parent::beforeSave();
 }
Exemple #15
0
 /**
  * Phương thức beforeSave() dùng để thiết lập các thông tin mặc định khi tạo user
  */
 public function beforeSave()
 {
     parent::beforeSave();
     if ($this->getIsNewRecord()) {
         $this->createtime = time();
         $this->superuser = User::NONSUPERUSER;
         $this->status = User::STATUS_NOACTIVE;
     }
     return true;
 }
 public function beforeSave()
 {
     if ($this->type == self::TYPE_IFRAME || $this->type == self::TYPE_LINK) {
         $this->content = $this->url;
     }
     if ($this->type == self::TYPE_WIDGET) {
         $this->navigation_class = 'null';
     } else {
         $this->widget_class = 'null';
     }
     if ($this->widget_targets != '') {
         $this->widget_targets = stristr($this->widget_targets, ',') ? json_encode(explode(',', trim($this->widget_targets))) : json_encode(array($this->widget_targets));
     }
     return parent::beforeSave();
 }