Exemplo n.º 1
0
 /**
  * AfterSave
  * Updates the layout and view if necessary
  * @see CActiveRecord::afterSave()
  */
 public function afterSave()
 {
     $this->saveLayoutAndView();
     return parent::afterSave();
 }
Exemplo n.º 2
0
 /**
  * AfterSave
  * Updates the layout and view if necessary
  * @see CActiveRecord::afterSave()
  */
 public function afterSave()
 {
     // Delete the AutoSave document on update
     if ($this->isPublished()) {
         $autosaveModel = ContentMetadata::model()->findByAttributes(array('content_id' => $this->id, 'key' => 'autosave'));
         if ($autosaveModel != NULL) {
             $autosaveModel->delete();
         }
     }
     return parent::afterSave();
 }
Exemplo n.º 3
0
 /**
  * After Save, incriments the comment count of the parent content
  * @return  bool
  */
 public function afterSave()
 {
     $content = Content::model()->findByPk($this->content_id);
     if ($content === NULL) {
         return true;
     }
     if (!$this->isNewRecord) {
         return true;
     }
     $content->comment_count = $content->getCommentCount();
     $content->save();
     $user = Users::model()->findByPk(Yii::app()->user->id);
     // Send an email to the author if someone makes a comment on their blog
     if ($content->author->id != Yii::app()->user->id && Cii::getConfig('notifyAuthorOnComment', 0) == 1) {
         Yii::app()->controller->sendEmail($user, Yii::t('ciims.email', 'New Comment Posted On {{title}}', array('{{title}}' => $content->title)), '//email/comment', array('content' => $content, 'comment' => $this));
     }
     return parent::afterSave();
 }
Exemplo n.º 4
0
 /**
  * Flushes URL data from the cache before the model is updated
  */
 public function afterSave()
 {
     $meta = CategoriesMetadata::model()->findByAttributes(array('category_id' => $this->id, 'key' => 'description'));
     if ($meta == NULL) {
         $meta = new CategoriesMetadata();
     }
     $meta->category_id = $this->id;
     $meta->key = 'description';
     $meta->value = $this->description;
     $meta->save();
     Yii::app()->cache->delete('CiiMS::Content::list');
     Yii::app()->cache->delete('CiiMS::Routes');
     Yii::app()->cache->delete('categories-pid');
     return parent::afterSave();
 }
Exemplo n.º 5
0
 /**
  * After a new comment is posted, set the reputation += 10
  * @see parent::afterSave();
  */
 public function afterSave()
 {
     if ($this->_isNewRecord) {
         $user = Users::model()->findByPk($this->author_id);
         $user->setReputation(10);
     }
     return parent::afterSave();
 }