public function beforeSave($insert) { if (parent::beforeSave($insert)) { return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$insert && $this->image != $this->oldAttributes['image'] && $this->oldAttributes['image']) { @unlink(Yii::getAlias('@webroot') . $this->oldAttributes['image']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->isNewRecord && $this->thumb != $this->oldAttributes['thumb']) { @unlink(Yii::getAlias('@webroot') . $this->oldAttributes['thumb']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->settings || !is_array($this->settings)) { $this->settings = self::getDefaultSettings($this->name); } $this->settings = json_encode($this->settings); return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { $settings = Yii::$app->getModule('admin')->activeModules['news']->settings; if ($this->short && $settings['enableShort']) { $this->short = StringHelper::truncate($this->short, $settings['shortMaxLength']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->ip = Yii::$app->request->userIP; $this->time = time(); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->items || !is_array($this->items)) { $this->items = []; } $this->items = json_encode($this->items); return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->data || !is_object($this->data) && !is_array($this->data)) { $this->data = new \stdClass(); } $this->data = json_encode($this->data); return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { $settings = Yii::$app->getModule('admin')->activeModules['article']->settings; $this->short = StringHelper::truncate($settings['enableShort'] ? $this->short : strip_tags($this->text), $settings['shortMaxLength']); if (!$insert && $this->image != $this->oldAttributes['image'] && $this->oldAttributes['image']) { @unlink(Yii::getAlias('@webroot') . $this->oldAttributes['image']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->ip = Yii::$app->request->userIP; $this->time = time(); $this->new = 1; $this->status = Yii::$app->getModule('admin')->activeModules['guestbook']->settings['preModerate'] ? self::STATUS_OFF : self::STATUS_ON; } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->isNewRecord) { $this->auth_key = $this->generateAuthKey(); $this->password = $this->hashPassword($this->password); } else { $this->password = $this->password != '' ? $this->hashPassword($this->password) : $this->oldAttributes['password']; } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { $settings = Yii::$app->getModule('admin')->activeModules['article']->settings; if ($this->short && $settings['enableShort']) { $this->short = StringHelper::truncate($this->short, $settings['shortMaxLength']); } if (!$this->isNewRecord && $this->thumb != $this->oldAttributes['thumb']) { @unlink(Yii::getAlias('@webroot') . $this->oldAttributes['thumb']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->data || !is_object($this->data) && !is_array($this->data)) { $this->data = new \stdClass(); } $this->data = json_encode($this->data); if (!$insert && $this->image != $this->oldAttributes['image'] && $this->oldAttributes['image']) { @unlink(Yii::getAlias('@webroot') . $this->oldAttributes['image']); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if (!$this->reviews || !is_array($this->reviews)) { $this->reviews = []; } $this->reviews = json_encode($this->reviews); if ($this->isNewRecord) { $this->status = 0; } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->_data !== null) { $this->dataJson = Json::encode($this->_data); $this->_data = null; } if ($insert) { $this->time = time(); $this->status = self::STATUS_NEW; } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->ip = Yii::$app->request->userIP; $this->access_token = Yii::$app->security->generateRandomString(32); $this->time = time(); } else { if ($this->oldAttributes['status'] == self::STATUS_BLANK && $this->status == self::STATUS_PENDING) { $this->new = 1; $this->mailAdmin(); } } return true; } else { return false; } }