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); }
public function confirm($id) { $data['active'] = 1; $data['valid'] = 1; $data['laststatuschange'] = Sydney_Tools::getMySQLFormatedDate(); $data['lastlogindate'] = Sydney_Tools::getMySQLFormatedDate(); if ($this->update($data, 'id = ' . $id)) { $objectParameter = new Parameters(); $objectParameter->delete('users_id = ' . $id . ' AND name = "mustBeConfirmedBefore" AND safinstances_id = ' . Sydney_Tools::getSafinstancesId()); return true; } return false; }