/**
  * @return string
  */
 public function run()
 {
     if ($this->model->hasProperty('mlConfig') and count($this->model->mlConfig['languages']) > 1) {
         return $this->render('multi');
     } else {
         return $this->render('single');
     }
 }
示例#2
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         $this->mailAdmin();
     }
 }
示例#3
0
 public function afterDelete()
 {
     parent::afterDelete();
     foreach ($this->getItems()->all() as $item) {
         $item->delete();
     }
 }
示例#4
0
 public function afterDelete()
 {
     parent::afterDelete();
     if ($this->image) {
         @unlink(Yii::getAlias('@webroot') . $this->image);
     }
 }
示例#5
0
文件: File.php 项目: kuzmiand/easyii
 public function afterDelete()
 {
     parent::afterDelete();
     //@unlink(Yii::getAlias('@webroot').$this->file);
     foreach (array_keys(Yii::$app->params['mlConfig']['languages']) as $lang) {
         $file_lang = $lang != Yii::$app->params['mlConfig']['default_language'] ? 'file_' . $lang : 'file';
         @unlink(Yii::getAlias('@webroot') . $this->{$file_lang});
     }
 }
示例#6
0
 public function afterDelete()
 {
     parent::afterDelete();
     foreach ($this->getItems()->all() as $item) {
         $item->delete();
     }
     if ($this->thumb) {
         @unlink(Yii::getAlias('@webroot') . $this->thumb);
     }
 }
示例#7
0
 public function afterDelete()
 {
     parent::afterDelete();
     if ($this->image) {
         @unlink(Yii::getAlias('@webroot') . $this->image);
     }
     foreach ($this->getPhotos()->all() as $photo) {
         $photo->delete();
     }
 }
示例#8
0
文件: Item.php 项目: mluludk/easyii
 public function afterDelete()
 {
     parent::afterDelete();
     foreach ($this->getPhotos()->all() as $photo) {
         $photo->delete();
     }
     if ($this->image) {
         @unlink(Yii::getAlias('@webroot') . $this->image);
     }
     ItemData::deleteAll(['item_id' => $this->primaryKey]);
 }
示例#9
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($insert) {
             $this->ip = Yii::$app->request->userIP;
             $this->time = time();
         }
         return true;
     } else {
         return false;
     }
 }
示例#10
0
文件: Admin.php 项目: via-en/easyii_2
 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;
     }
 }
示例#11
0
 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;
     }
 }
示例#12
0
 public static function get($name)
 {
     if (!self::$_data) {
         self::$_data = Data::cache(self::CACHE_KEY, 3600, function () {
             $result = [];
             try {
                 foreach (parent::find()->all() as $setting) {
                     $result[$setting->name] = $setting->value;
                 }
             } catch (\yii\db\Exception $e) {
             }
             return $result;
         });
     }
     return isset(self::$_data[$name]) ? self::$_data[$name] : null;
 }
示例#13
0
 public function afterDelete()
 {
     parent::afterDelete();
 }
示例#14
0
 public function afterDelete()
 {
     parent::afterDelete();
     @unlink(Yii::getAlias('@webroot') . $this->file);
 }
示例#15
0
 public function behaviors()
 {
     return array_merge_recursive(parent::behaviors(), ['seoBehavior' => SeoBehavior::className()]);
 }
示例#16
0
 public function afterFind()
 {
     parent::afterFind();
     $this->settings = $this->settings !== '' ? json_decode($this->settings, true) : $this->getDefaultSettings();
     $this->syncSettings();
 }
示例#17
0
 public function behaviors()
 {
     return array_merge_recursive(parent::behaviors(), ['cn' => ['class' => CalculateNotice::className(), 'callback' => function () {
         return self::find()->status(self::STATUS_NEW)->count();
     }]]);
 }
示例#18
0
 public function afterFind()
 {
     parent::afterFind();
     $this->settings = $this->settings !== '' ? json_decode($this->settings, true) : self::getDefaultSettings($this->name);
 }
示例#19
0
 public function __set($name, $value)
 {
     $fields = FeedbackModule::getFormFields();
     if (isset($fields[$name])) {
         $data = $this->getData();
         $data[$name] = $value;
         $this->setData($data);
         return;
     }
     parent::__set($name, $value);
 }
示例#20
0
 public function afterFind()
 {
     parent::afterFind();
     $this->parseItems();
 }
示例#21
0
 /**
  * @inheritDoc
  */
 public function attributeLabels()
 {
     return ArrayHelper::merge(parent::attributeLabels(), ['url' => 'URL', 'h1' => 'H1', 'page_description' => 'Описание страницы']);
 }
示例#22
0
 public function afterDelete()
 {
     parent::afterDelete();
     foreach ($this->getGoods()->all() as $good) {
         $good->delete();
     }
 }