示例#1
0
 public function afterSave()
 {
     $this->sendNotification();
     return parent::afterSave();
 }
 /**
  * After Saving of records of type content, automatically add/bind the
  * corresponding content to it.
  *
  * If the automatic wall adding (autoAddToWall) is enabled, also create
  * wall entry for this content.
  *
  * NOTE: If you overwrite this method, e.g. for creating activities ensure
  * this (parent) implementation is invoked BEFORE your implementation. Otherwise
  * the Content Object is not available.
  */
 public function afterSave()
 {
     // Auto follow this content
     if (get_class($this) != 'Activity') {
         $this->follow($this->created_by);
     }
     if ($this->isNewRecord) {
         $this->content->user_id = $this->created_by;
         $this->content->object_model = get_class($this);
         $this->content->object_id = $this->getPrimaryKey();
         $this->content->created_at = $this->created_at;
         $this->content->created_by = $this->created_by;
     }
     $this->content->updated_at = $this->updated_at;
     $this->content->updated_by = $this->updated_by;
     $this->content->save();
     parent::afterSave();
     if ($this->isNewRecord && $this->autoAddToWall) {
         $this->content->addToWall();
     }
     // When Space Content, update also last visit
     if ($this->content->space_id) {
         $membership = $this->content->space->getMembership(Yii::app()->user->id);
         if ($membership) {
             $membership->updateLastVisit();
         }
     }
 }
示例#3
0
 public function afterSave()
 {
     parent::afterSave();
     LiveCategoryItem::model()->deleteAllByAttributes(array('item_id' => $this->id));
     $arrCat = explode(",", $this->categories);
     foreach ($arrCat as $cat) {
         $model = new LiveCategoryItem();
         $model->category_id = $cat;
         $model->item_id = $this->id;
         $model->save();
     }
 }
示例#4
0
 /**
  * Before saving an new record, cleanup all old user passwords
  */
 public function afterSave()
 {
     UserPassword::model()->deleteAllByAttributes(array('user_id' => $this->user_id), 'id != :id ', array(':id' => $this->id));
     return parent::afterSave();
 }
 /**
  * After saving content addon, mark underlying content as updated.
  * 
  * @return boolean
  */
 protected function afterSave()
 {
     // Auto follow the content which this addon belongs to
     $this->getContent()->getUnderlyingObject()->follow($this->created_by);
     return parent::afterSave();
 }
示例#6
0
 protected function afterSave()
 {
     // Set new uploaded file
     if ($this->cUploadedFile !== null && $this->cUploadedFile instanceof CUploadedFile) {
         $newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
         if (is_uploaded_file($this->cUploadedFile->getTempName())) {
             move_uploaded_file($this->cUploadedFile->getTempName(), $newFilename);
             @chmod($newFilename, 0744);
         }
     }
     // Set file by given contents
     if ($this->newFileContent != null) {
         $newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
         file_put_contents($newFilename, $this->newFileContent);
         @chmod($newFilename, 0744);
     }
     return parent::afterSave();
 }
示例#7
0
 /**
  * After Save, also saving the underlying Field Type
  */
 public function afterSave()
 {
     # Cause Endless
     #$this->fieldType->save();
     return parent::afterSave();
 }
示例#8
0
 /**
  * After saving check if its required to rewrite the configuration file.
  * 
  * @todo Find better way to detect when we need to rewrite the local config
  */
 public function afterSave()
 {
     parent::afterSave();
     // Only rewrite static configuration file when necessary
     if ($this->module_id != 'mailing' && $this->module_id != 'cache' && $this->name != 'name' && $this->name != 'defaultLanguage' && $this->name != 'theme') {
         return;
     }
     self::rewriteConfiguration();
 }
 public function afterSave()
 {
     WikiPageRevision::model()->updateAll(array('is_latest' => 0), 'wiki_page_id=:wikiPageId AND id!=:selfId', array(':wikiPageId' => $this->wiki_page_id, ':selfId' => $this->id));
     return parent::afterSave();
 }
示例#10
0
文件: File.php 项目: Wikom/humhub
 protected function afterSave()
 {
     // Set new uploaded file
     if ($this->cUploadedFile !== null && $this->cUploadedFile instanceof CUploadedFile) {
         $newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
         if (is_uploaded_file($this->cUploadedFile->getTempName())) {
             move_uploaded_file($this->cUploadedFile->getTempName(), $newFilename);
             @chmod($newFilename, 0744);
         }
         /**
          * For uploaded jpeg files convert them again - to handle special
          * exif attributes (e.g. orientation)
          */
         if ($this->cUploadedFile->getType() == 'image/jpeg') {
             ImageConverter::TransformToJpeg($newFilename, $newFilename);
         }
     }
     // Set file by given contents
     if ($this->newFileContent != null) {
         $newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
         file_put_contents($newFilename, $this->newFileContent);
         @chmod($newFilename, 0744);
     }
     return parent::afterSave();
 }
示例#11
0
 /**
  * After saving content addon, mark underlying content as updated.
  * 
  * @return boolean
  */
 protected function afterSave()
 {
     // Workaround for files, which have no object_model / id on uploading
     if ($this->object_model != "" && $this->object_id != "") {
         $this->content->save();
     }
     return parent::afterSave();
 }