コード例 #1
0
ファイル: TranslateMessage.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     $langs = Lang::getActiveLangs();
     foreach ($langs as $lang) {
         Yii::app()->cache->delete(DbMessageSource::CACHE_KEY_PREFIX . '.messages.' . $this->category . '.' . $lang);
     }
     return parent::afterSave();
 }
コード例 #2
0
ファイル: Lang.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if ($this->isNewRecord) {
         $this->addLang($this->name_iso);
         Yii::app()->cache->flush();
     }
     return parent::afterSave();
 }
コード例 #3
0
ファイル: Article.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if (issetModule('seo') && param('genFirendlyUrl')) {
         SeoFriendlyUrl::getAndCreateForModel($this);
     }
     return parent::afterSave();
 }
コード例 #4
0
ファイル: Comment.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if ($this->status == Comment::STATUS_APPROVED) {
         $this->_calcRating();
         //            if($this->model_name == 'Apartment'){
         //                $ad = Apartment::model()->with('user')->findByPk($this->model_id);
         //                if($ad && isset($ad->user)){
         //                    $user = $ad->user;
         //                    $notifier = new Notifier();
         //                    $notifier->raiseEvent('onNewComment', $this, array('user' => $user));
         //                }
         //            }
     }
     if ($this->isNewRecord) {
         if (!Yii::app()->user->isGuest) {
             $model = HUser::getModel();
             $this->user_name = $model->username;
             $this->user_email = $model->email;
         }
         $notifier = new Notifier();
         $notifier->raiseEvent('onNewComment', $this);
     }
     return parent::afterSave();
 }
コード例 #5
0
ファイル: Apartment.php プロジェクト: alexjkitty/estate
 public function afterSave()
 {
     if ($this->scenario == 'savecat') {
         $this->saveCategories();
         if ($this->metroStations) {
             $this->setMetroStations($this->metroStations);
         }
     }
     if ($this->panoramaFile) {
         $panorama = new ApartmentPanorama();
         $panorama->fileInstance = $this->panoramaFile;
         $panorama->apartment_id = $this->id;
         $panorama->save();
     }
     if (issetModule('seo') && param('genFirendlyUrl')) {
         SeoFriendlyUrl::getAndCreateForModel($this);
     }
     if (issetModule('socialposting') && $this->active == self::STATUS_ACTIVE && ($this->owner_active = self::STATUS_ACTIVE)) {
         SocialpostingModel::preparePosting($this);
     }
     $sql = 'DELETE FROM {{apartment}} WHERE active=:draft AND date_created<DATE_SUB(NOW(),INTERVAL 1 DAY)';
     Yii::app()->db->createCommand($sql)->execute(array(':draft' => self::STATUS_DRAFT));
     return parent::afterSave();
 }
コード例 #6
0
ファイル: FormDesigner.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if ($this->scenario == 'save_types' || $this->scenario == 'advanced') {
         $sql = "DELETE FROM {{formdesigner_obj_type}} WHERE formdesigner_id=:formdesigner_id";
         Yii::app()->db->createCommand($sql)->execute(array(':formdesigner_id' => $this->id));
     }
     if ($this->saveObjTypes) {
         foreach ($this->saveObjTypes as $typeID) {
             $formDesignerType = new FormDesignerObjType();
             $formDesignerType->formdesigner_id = $this->id;
             $formDesignerType->obj_type_id = $typeID;
             $formDesignerType->save();
         }
     }
     return parent::afterSave();
 }
コード例 #7
0
ファイル: ApartmentObjType.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if ($this->isNewRecord) {
         if (issetModule('formdesigner')) {
             Yii::import('application.modules.formdesigner.models.*');
             $forms = FormDesigner::model()->findAll();
             foreach ($forms as $form) {
                 $formType = new FormDesignerObjType();
                 $formType->formdesigner_id = $form->id;
                 $formType->obj_type_id = $this->id;
                 $formType->save();
             }
         }
         $searchFields = SearchFormModel::model()->sort()->findAllByAttributes(array('obj_type_id' => SearchFormModel::OBJ_TYPE_ID_DEFAULT));
         foreach ($searchFields as $field) {
             $newSearch = new SearchFormModel();
             $newSearch->attributes = $field->attributes;
             $newSearch->obj_type_id = $this->id;
             $newSearch->save();
         }
     }
     return parent::afterSave();
 }