Ejemplo n.º 1
0
 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);
 }