Ejemplo n.º 1
0
 public static function getBlockDetailsByLangID($blockID, $langID)
 {
     $blockIndex = new BlocksIndex();
     $select = $blockIndex->select()->setIntegrityCheck(false)->from('BlocksIndex')->join('Blocks', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('BlocksIndex.BI_LanguageID = ?', $langID)->where('BlocksIndex.BI_BlockID= ?', $blockID);
     $block = $blockIndex->fetchRow($select);
     if (empty($block)) {
         $newrow = $blockIndex->createRow(array('BI_BlockID' => $blockID, 'BI_LanguageID' => $langID));
         $newrow->save();
         $block = $blockIndex->fetchRow($select);
     }
     return $block;
 }
Ejemplo n.º 2
0
 public function deleteBlockAction()
 {
     // variables
     $_pageID = (int) $this->_getParam('ID');
     $_blockID = (int) $this->_getParam('blockID');
     if (Cible_ACL::hasAccess($_pageID)) {
         if ($this->_request->isPost()) {
             // if is set delete, then delete
             $delete = isset($_POST['delete']);
             if ($delete && $_blockID > 0) {
                 // never remove the news themselves
                 /* DELETE ROW IN BLOCK TABLE(S)   */
                 if (method_exists($this, 'delete')) {
                     $this->delete($_blockID);
                 }
                 $this->deleteBlock($_blockID);
                 if ($this->_isXmlHttpRequest) {
                     $this->disableView();
                     echo Zend_Json::encode(array('result' => true));
                     return;
                 }
             }
             $this->_redirect('/page/manage/index/ID/' . $_pageID);
         } else {
             if ($_pageID > 0) {
                 // get page information
                 $page = new Pages();
                 $this->view->page = $page->fetchRow('P_ID=' . $_pageID);
                 $pageIndex = new PagesIndex();
                 $select = $pageIndex->select()->where("PI_PageID = ?", $_pageID)->where("PI_LanguageID = ?", Zend_Registry::get("languageID"));
                 $this->view->pageIndex = $pageIndex->fetchRow($select);
                 // get block information
                 $blockIndex = new BlocksIndex();
                 $select = $blockIndex->select()->where('BI_BlockID = ?', $_blockID)->where('BI_LanguageID = ?', Zend_Registry::get("languageID"));
                 $this->view->blockIndex = $blockIndex->fetchRow($select);
             }
         }
     }
 }