Exemplo n.º 1
0
 public function beforeDelete()
 {
     if (!empty($this->jobs)) {
         return false;
     }
     return parent::beforeDelete();
 }
Exemplo n.º 2
0
 /**
  * Before-delete hook
  *
  * @return type 
  */
 protected function beforeDelete()
 {
     if (!$this->canBeDeleted) {
         return false;
     }
     return parent::beforeDelete();
 }
Exemplo n.º 3
0
 public function beforeDelete()
 {
     $item = InventoryItems::model()->findByPk($this->item_id);
     $item->qty += $this->qty;
     $item->save();
     return parent::beforeDelete();
 }
Exemplo n.º 4
0
 /**
  * Make sure we delete any comments
  */
 public function beforeDelete()
 {
     foreach ($this->comments as $comment) {
         $comment->delete();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 5
0
 /**
  *
  **/
 protected function beforeDelete()
 {
     if (parent::beforeDelete()) {
         unlink(Yii::app()->params->imageBasePath . DIRECTORY_SEPARATOR . $this->filename);
     }
     return true;
 }
Exemplo n.º 6
0
 protected function beforeDelete()
 {
     foreach ($this->candidates() as $candidate) {
         $candidate->delete();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 7
0
 public function beforeDelete()
 {
     parent::beforeDelete();
     foreach ($this->points as $point) {
         $point->delete();
     }
     return true;
 }
Exemplo n.º 8
0
 protected function beforeDelete()
 {
     if (parent::beforeDelete()) {
         if ($this->demo_real && @unlink(Yii::getPathOfAlias('webroot.include.files') . DIRECTORY_SEPARATOR . $this->demo_file)) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 9
0
 public function beforeDelete()
 {
     $this->cacheId = $this->attribute_group_id;
     // delete relations
     foreach ($this->attributes as $attribute) {
         $attribute->delete();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 10
0
 protected function beforeDelete()
 {
     foreach ($this->seats() as $seat) {
         $seat->delete();
     }
     foreach ($this->tokens() as $token) {
         $token->delete();
     }
     return parent::beforeDelete();
 }
 /**
  * Make sure we delete any posts
  */
 public function beforeDelete()
 {
     foreach ($this->posts as $post) {
         $post->delete();
     }
     foreach ($this->subs as $sub) {
         $sub->delete();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 12
0
 protected function beforeDelete()
 {
     $result = parent::beforeDelete();
     if (!$result) {
         return false;
     }
     if ($this->album && $this->album->isCover($this)) {
         $this->coverShouldBeUpdated = true;
     }
     return $result;
 }
Exemplo n.º 13
0
 protected function beforeDelete()
 {
     if (parent::beforeDelete()) {
         foreach ($this->catalogProducts as $product) {
             $product->delete();
         }
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 14
0
 public function beforeDelete()
 {
     /* remove all nodes attached to this mindmap */
     $sql = strtr('DELETE FROM {table} WHERE mindmap_id=:mindmap_id', array('{table}' => Node::model()->tableName()));
     try {
         Yii::app()->db->createCommand($sql)->bindValue(':mindmap_id', $this->id)->execute();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 15
0
 /**
  * Custom actions before deleting a record
  * @return boolean
  */
 protected function beforeDelete()
 {
     if (parent::beforeDelete()) {
         if ($childs = $this->childs) {
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
         return true;
     }
     return false;
 }
Exemplo n.º 16
0
 public function beforeDelete()
 {
     $sql = 'SELECT file_path FROM {{messages_files}} WHERE id="' . $this->id . '"';
     $item = Yii::app()->db->createCommand($sql)->queryScalar();
     $message = new Messages();
     if ($item) {
         if (file_exists($message->uploadPath . '/' . $item)) {
             unlink($message->uploadPath . '/' . $item);
         }
     }
     return parent::beforeDelete();
 }
Exemplo n.º 17
0
 protected function beforeDelete()
 {
     try {
         foreach ($this->micrositio_x_genero as $micrositio_x_genero) {
             $mxg = MicrositioXGenero::model()->findByPk($micrositio_x_genero->id);
             $mxg->delete();
         }
         return parent::beforeDelete();
     } catch (Exception $e) {
         return false;
     }
 }
Exemplo n.º 18
0
 public function beforeDelete()
 {
     //DebugBreak();
     $db = $this->getDbConnection();
     if ($db->getCurrentTransaction() === null) {
         //if do not exists current...
         $this->_transaction = $db->beginTransaction();
         // ... start new transaction
     }
     return parent::beforeDelete();
     //run parent event handler... IT MUST BE!!!
 }
Exemplo n.º 19
0
 public function beforeDelete()
 {
     if (!$this->alias->isLeaf()) {
         echo '<div class="flash-error">' . Yii::t('contentModule.admin', 'Vous devez relocaliser les sous-pages avant de supprimer celle-ci.') . '</div>';
         return false;
     } else {
         foreach ($this->blocs as $bloc) {
             $bloc->delete();
         }
         $this->alias->deleteNode();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 20
0
 public function beforeDelete()
 {
     //DebugBreak();
     $tagposts = Tagpost::model()->findAll('post_id = :post_id', array(':post_id' => $this->post_id));
     if (!empty($tagposts)) {
         foreach ($tagposts as $tagpost) {
             //delete all tags relations
             $tagpost->delete();
         }
     }
     return parent::beforeDelete();
     //run parent event handler... IT MUST BE!!!
 }
Exemplo n.º 21
0
 protected function beforeDelete()
 {
     if (!parent::beforeDelete()) {
         return false;
     }
     $file = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->getBaseUrl() . '/Image/AttachmentProject/' . $this->img;
     $fileMini = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->getBaseUrl() . '/Image/AttachmentProject/mini-' . $this->img;
     if (file_exists($file) and $this->img != '') {
         unlink($file);
     }
     if (file_exists($fileMini) and $this->img != '') {
         unlink($fileMini);
     }
     return true;
 }
Exemplo n.º 22
0
 protected function beforeDelete()
 {
     if (parent::beforeDelete() === true) {
         if (isset(Yii::app()->params) && isset(Yii::app()->params->isDemo)) {
             $this->isDemo = Yii::app()->params->isDemo;
         }
         if ($this->isDemo) {
             Yii::app()->user->setFlash('demo_mode', $this->errorDelete);
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 23
0
 protected function beforeDelete()
 {
     try {
         foreach ($this->menuItems as $menuItem) {
             $mi = MenuItem::model()->findByPk($menuItem->id);
             $mi->delete();
         }
         foreach ($this->micrositios as $micrositio) {
             $m = $micrositio->findByPk($micrositio->id);
             $m->menu_id = NULL;
             $m->save();
         }
         return parent::beforeDelete();
     } catch (Exception $e) {
         return false;
     }
 }
Exemplo n.º 24
0
 public function beforeDelete()
 {
     $modelsSamePage = self::model()->multilang()->findAllByAttributes(array('parent_id' => $this->parent_id));
     foreach ($modelsSamePage as $model) {
         if ($model->rank > $this->rank) {
             $model->rank--;
             $model->save();
         }
     }
     $className = 'Bloc' . ucfirst($this->bloc_type);
     $bloc = $className::model()->findByPk($this->bloc_id);
     foreach ($bloc->behaviors() as $behaviorName => $behavior) {
         if ($behavior['class'] == 'application.components.behaviors.BlocBehavior') {
             $bloc->{$behaviorName}->deleting = true;
         }
     }
     $bloc->delete();
     return parent::beforeDelete();
 }
Exemplo n.º 25
0
 protected function beforeDelete()
 {
     if (!parent::beforeDelete()) {
         return false;
     }
     foreach ($this->attachment as $key => $value) {
         $model = AttachmentProject::model()->findByPk($value->id);
         $model->delete();
     }
     $file = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->getBaseUrl() . '/Image/Project/' . $this->img;
     $fileMini = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->getBaseUrl() . '/Image/Project/mini-' . $this->img;
     if (file_exists($file) and $this->img != '') {
         unlink($file);
     }
     if (file_exists($fileMini) and $this->img != '') {
         unlink($fileMini);
     }
     return true;
 }
Exemplo n.º 26
0
 /**
  *   This method is called before deleting AR model from database table.
  *   In this method, we delete file attachment.
  */
 protected function beforeDelete()
 {
     // First call the base class
     if (!parent::beforeDelete()) {
         return false;
     }
     // Remove related comment
     if ($this->comment) {
         $this->comment->delete();
     }
     // Delete related file attachments
     foreach ($this->attachments as $attachment) {
         $attachment->delete();
     }
     // Delete related bug status change
     if (isset($this->statuschange)) {
         $this->statuschange->delete();
     }
     return true;
 }
Exemplo n.º 27
0
 public function beforeDelete()
 {
     $this->deleteRecursive();
     return parent::beforeDelete();
 }
Exemplo n.º 28
0
	public function beforeDelete()
	{
		parent::beforeDelete();
        
		$sql = "SELECT COUNT(*) FROM vote WHERE review={$this->review} and vote={$this->vote}";
        $numClients = Yii::app()->db->createCommand($sql)->queryScalar();
        if($this->vote == 1){
            $review = Article::model()->updateByPk($this->review,array('yes'=>($numClients-1)));
        } else {
            $review = Article::model()->updateByPk($this->review,array('no'=>($numClients-1)));
        }
		
		return true;
	}
Exemplo n.º 29
0
 /**
  * Before deleting a SIContent try to delete all corresponding SIContentAddons.
  */
 public function beforeDelete()
 {
     // delete also all wall entries
     foreach ($this->getWallEntries() as $entry) {
         $entry->delete();
     }
     // remove from search index
     if ($this->object_model instanceof ISearchable) {
         HSearch::getInstance()->deleteModel($this->getContentObject());
     }
     // Remove From User Content
     UserContent::model()->deleteAllByAttributes(array('object_model' => $this->object_model, 'object_id' => $this->object_id));
     // Try delete the underlying object (Post, Question, Task, ...)
     if ($this->getUnderlyingObject() !== null) {
         $this->getUnderlyingObject()->delete();
     }
     return parent::beforeDelete();
 }
Exemplo n.º 30
0
 protected function beforeDelete()
 {
     parent::beforeDelete();
     $servers = AdminsServers::model()->findByAttributes(array('admin_id' => $this->id));
     if ($servers !== null) {
         $servers->deleteAllByAttributes(array('admin_id' => $this->id));
     }
     return true;
 }