public static function deleteAllBlock($PageID) { $textSelect = new Blocks(); $select = $textSelect->select()->setIntegrityCheck(false)->from('Blocks')->where('B_PageID = ?', $PageID)->join('TextData', 'TD_BlockID = B_ID'); $textData = $textSelect->fetchAll($select); foreach ($textData as $text) { $indexData['moduleID'] = $text['B_ModuleID']; $indexData['contentID'] = $text['TD_ID']; $indexData['languageID'] = $text['TD_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); } $Blocks = new Blocks(); $Where = "B_PageID = " . $PageID; $Blocks->delete($Where); }
protected function deleteBlock($blockID) { /* * ******************************* */ /* DELETE ROW IN BLOCK TABLE */ /* * ******************************* */ // define block $block = new Blocks(); $where = 'B_ID = ' . $blockID; // get informations of the block to delete $blockDetails = $block->fetchRow($where); $position = $blockDetails->B_Position; $pageID = $blockDetails->B_PageID; // delete the block $block->delete($where); /* * ******************************* */ /* DELETE ROWS IN BLOCKINDEX TABLE */ /* * ******************************* */ // define blockIndex $blockIndex = new BlocksIndex(); $where = 'BI_BlockID = ' . $blockID; // delete all blockIndex $blockIndex->delete($where); /* * ******************************* */ /* UPDATE POSITION ON BLOCK TABLE */ /* * ******************************* */ // update position of all block in the same page $db = Zend_Registry::get("db"); $where = "(B_Position > " . $position . ") AND B_PageID = " . $pageID; $db->update('Blocks', array('B_Position' => new Zend_Db_Expr('B_Position - 1')), $where); /* * ******************************* */ /* DELETE ROWS IN PARAMETERS TABLE */ /* * ******************************* */ $blockParameters = new Parameters(); $where = 'P_BlockID = ' . $blockID; $blockParameters->delete($where); }