Example #1
0
 public function run()
 {
     if (!param('genFirendlyUrl')) {
         return '';
     }
     if (!$this->model) {
         return NULL;
     }
     $friendlyUrl = SeoFriendlyUrl::getAndCreateForModel($this->model);
     $this->render('seoWidget', array('model' => $this->model, 'friendlyUrl' => $friendlyUrl));
 }
Example #2
0
 public function afterSave()
 {
     if (issetModule('seo') && param('genFirendlyUrl')) {
         SeoFriendlyUrl::getAndCreateForModel($this);
     }
     return parent::afterSave();
 }
Example #3
0
 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();
 }