function indexAction() { $ParamsArray = $this->_request->getParams(); $Pages = new PagesIndex(); $Select = $Pages->select()->setIntegrityCheck(false)->from('PagesIndex')->join('Languages', 'Languages.L_ID = PagesIndex.PI_LanguageID')->join('Pages', 'Pages.P_ID = PagesIndex.PI_PageID')->join('Page_Themes', 'Page_Themes.PT_ID = Pages.P_ThemeID')->join('Views', 'Views.V_ID = Pages.P_ViewID')->where('Pages.P_Home = ?', 1)->where('PagesIndex.PI_LanguageID = ?', $this->_config->defaultInterfaceLanguage)->limit(1); $Row = $Pages->fetchRow($Select); // if the controller is found in the database if (count($Row) == 1) { // call page controller to display blocks $this->_helper->actionStack('index', 'page', 'default', array('Row' => $Row, 'Param' => $ParamsArray)); $this->disableView(); } }
public static function getPageDetails($PageID, $langId = null) { $langId = is_null($langId) ? Zend_Registry::get('currentEditLanguage') : $langId; $Pages = new PagesIndex(); $Select = $Pages->select()->setIntegrityCheck(false)->from('Pages')->joinLeft('PagesIndex', 'Pages.P_ID = PagesIndex.PI_PageID')->joinLeft('Views', 'Pages.P_ViewID = Views.V_ID')->where('PagesIndex.PI_LanguageID = ?', $langId)->where('PagesIndex.PI_PageID= ?', $PageID); $row = $Pages->fetchRow($Select); if (empty($row)) { $Pages = new Pages(); $Select = $Pages->select()->where('P_ID = ?', $PageID); $row = $Pages->fetchRow($Select); } return $row; }
function indexAction() { // retrieve the ID of the requested page $pageID = $this->view->pageID = $this->_getParam('ID'); $pageDetails = new PagesIndex(); $pageDetailsSelect = $pageDetails->select(); $pageDetailsSelect->where('PI_PageID = ?', $pageID)->where('PI_LanguageID = ?', $this->_defaultEditLanguage); $pageDetailsData = $pageDetails->fetchRow($pageDetailsSelect)->toArray(); $this->view->assign("pageTitle", $pageDetailsData["PI_PageTitle"]); $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "data")) { $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "structure")) { $this->view->assign('hasAccessToStructure', true); } // Retrieve the page view layout $page = new Pages(); $page_select = $page->select()->setIntegrityCheck(false); $page_select->from('Pages')->join('Views', 'Pages.P_ViewID = Views.V_ID')->where('P_ID = ?', $pageID); $page_info = Cible_FunctionsPages::getPageViewDetails($pageID); $template_file = 'index/' . $page_info['V_Path']; $_zone_count = $page_info['V_ZoneCount']; // make a request to get all the blocks to be displayed $blocks = new Blocks(); $select = $blocks->select()->setIntegrityCheck(false); $select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Pages', 'Blocks.B_PageID = P_ID')->join('BlocksIndex', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('Blocks.B_PageID = ?', $pageID)->where('BlocksIndex.BI_LanguageID = ?', Zend_Registry::get('languageID'))->order('Blocks.B_Position ASC'); //Send the results to the view $rows = $blocks->fetchAll($select); $_blocks = array(); foreach ($rows as $row) { // create the placeholder object if not already defined if (!isset($_blocks[$row['B_ZoneID']])) { $_blocks[$row['B_ZoneID']] = array(); } $_blocks[$row['B_ZoneID']][] = $row->toArray(); } $this->view->assign('template_file', $template_file); $this->view->assign('zone_count', $_zone_count); $this->view->assign('blocks', $_blocks); // Load the modules in the view $Modules = new Modules(); $modules = $Modules->fetchAll(); $this->view->assign('modules', $modules->toArray()); } else { $this->view->assign('template_file', ""); $this->view->assign('error_message_permission', $this->view->getCibleText('error_message_permission')); } }
function deleteAction() { $this->view->title = "Supprimer une page"; // retrieve the ID of the parent page $PageID = $this->_getParam('ID'); if (Cible_ACL::hasAccess($PageID)) { // generates tree by Language and send the result to the view Zend_Registry::set('baseUrl', $this->view->baseUrl()); $this->view->TreeView = $this->view->getTreeView(); if ($this->_request->isPost()) { //$PageID = (int)$this->_request->getPost('PageID'); // if is set delete, then delete $delete = isset($_POST['delete']); if ($delete && $PageID > 0) { Cible_FunctionsPages::deleteAllChildPage($PageID); Cible_FunctionsPages::deleteAllBlock($PageID); $pageSelect = new PagesIndex(); $select = $pageSelect->select()->where('PI_PageID = ?', $PageID); $pageData = $pageSelect->fetchAll($select)->toArray(); foreach ($pageData as $page) { $indexData['moduleID'] = 0; $indexData['contentID'] = $PageID; $indexData['languageID'] = $page['PI_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); } $Page = new Pages(); $Where = 'P_ID = ' . $PageID; $Page->delete($Where); $PageIndex = new PagesIndex(); $Where = 'PI_PageID = ' . $PageID; $PageIndex->delete($Where); if (!$this->_request->isXmlHttpRequest()) { $this->_redirect('/'); } } else { if (!$this->_isXmlHttpRequest) { $this->_redirect('/page/edit/ID/' . $PageID); } } } else { if ($PageID > 0) { $Page = new Pages(); $this->view->page = $Page->fetchRow('P_ID=' . $PageID); $PageIndex = new PagesIndex(); $Select = $PageIndex->select()->where("PI_PageID = ?", $PageID)->where("PI_LanguageID = ?", $this->_defaultEditLanguage); $this->view->pageindex = $PageIndex->fetchRow($Select); } } } }
public function errorAction() { $errors = $this->_getParam('error_handler'); //$exception = $errors->exception; Zend_Registry::set('baseUrl', $this->getFrontController()->getBaseUrl()); switch ($errors->type) { // if it is a controller error case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: // grab the controller, action and settings requested by the user $ParamsArray = $errors->request->getParams(); if ($this->_request->controller == "robots.txt") { $this->robotsAction(); $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); //Cible_FunctionsRobots::robotsAction(); exit; } $ControllerName = $ParamsArray['controller']; $ActionName = $ParamsArray['action']; // check if the name of the controller is in the database $Pages = new PagesIndex(); $Select = $Pages->select()->setIntegrityCheck(false)->from('PagesIndex')->join('Languages', 'Languages.L_ID = PagesIndex.PI_LanguageID')->join('Pages', 'Pages.P_ID = PagesIndex.PI_PageID')->join('Page_Themes', 'Page_Themes.PT_ID = Pages.P_ThemeID')->join('Views', 'Views.V_ID = Pages.P_ViewID')->where('PagesIndex.PI_PageIndex = ?', $ControllerName)->where('PI_Status = 1')->limit(1); $Row = $Pages->fetchRow($Select); // if the controller is found in the database if (count($Row) == 1) { // call page controller to display blocks $this->_helper->actionStack('index', 'page', 'default', array('Row' => $Row, 'Param' => $ParamsArray)); // does not render the page Error404 $this->disableView(); } else { $session = new Cible_Sessions(); $currentLanguageID = !empty($session->languageID) ? $session->languageID : $this->_config->defaultInterfaceLanguage; $page_not_found_id = $this->_config->page_not_found->pageID; $pageIndexName = Cible_FunctionsPages::getPageNameByID($page_not_found_id, $currentLanguageID); // check if the name of the controller is in the database $Pages = new PagesIndex(); $Select = $Pages->select()->setIntegrityCheck(false)->from('PagesIndex')->join('Languages', 'Languages.L_ID = PagesIndex.PI_LanguageID')->join('Pages', 'Pages.P_ID = PagesIndex.PI_PageID')->join('Page_Themes', 'Page_Themes.PT_ID = Pages.P_ThemeID')->join('Views', 'Views.V_ID = Pages.P_ViewID')->where('PagesIndex.PI_PageIndex = ?', $pageIndexName)->where('PI_Status = 1')->limit(1); $Row = $Pages->fetchRow($Select); if (count($Row) == 1) { // call page controller to display blocks $this->_helper->actionStack('index', 'page', 'default', array('Row' => $Row, 'Param' => $ParamsArray)); // does not render the page Error404 $this->disableView(); } else { $this->disableLayout(); echo "404 Page not found."; } $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found'); } break; case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: // does not render the page Error404 $this->disableLayout(); $this->disableView(); echo "Erreur d'action "; break; default: // application error; display error page, but don't change // status code // ... // Log the exception: $exception = $errors->exception; /*$log = new Zend_Log( new Zend_Log_Writer_Stream( '/tmp/applicationException.log' ) ); $log->debug($exception->getMessage() . "\n" . $exception->getTraceAsString()); */ echo <<<End_of_error <p> <strong>Error</strong> {$exception->getMessage()} </p> <p> <strong>Stack Trace</strong> {$exception->getTraceAsString()} </p> End_of_error; break; } }
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); } } } }
public function indexAction() { $params['keywords'] = $searchParams['words'] = $searchWords = $this->_getParam('words'); $this->view->assign('words', $searchParams['words']); $languageID = $lang = Zend_Registry::get('languageID'); $db = Zend_Registry::get("db"); $searchResults = array(); $searchCount = 0; $searchResult = Cible_FunctionsIndexation::indexationSearch($searchParams); //$this->view->dump($searchResult); /* * ********* TEXT ************* */ $moduleID = 1; $i = 0; $y = 0; $pageSelect = new PagesIndex(); $searchPage = array(); $pageIDArray = array(); foreach ($searchResult as $result) { if ($result['moduleID'] == $moduleID && $result['languageID'] == $languageID || $result['moduleID'] == 0 && $result['languageID'] == $languageID) { $select = $pageSelect->select()->where('PI_PageID = ?', $result['pageID'])->where('PI_LanguageID = ?', $result['languageID'])->where('PI_Status = 1'); $pageData = $pageSelect->fetchRow($select); if ($pageData && !in_array($result['pageID'], $pageIDArray)) { $pageIDArray[] = $result['pageID']; $searchPage[$y]['moduleID'] = $result['moduleID']; $searchPage[$y]['pageID'] = $result['pageID']; $searchPage[$y]['contentID'] = $result['contentID']; $searchPage[$y]['languageID'] = $result['languageID']; $searchPage[$y]['title'] = $result['title']; $searchPage[$y]['text'] = $result['text']; $searchPage[$y]['link'] = $result['link']; $searchPage[$y]['pageTitle'] = $pageData['PI_PageTitle']; $searchPage[$y]['pageIndex'] = $pageData['PI_PageIndex']; $y++; $searchCount++; } array_splice($searchResult, $i, 1); } else { $i++; } } $this->view->assign('searchPage', $searchPage); /* * *************************** */ /* * ********* NEWS ************* */ $moduleID = 2; $i = 0; $y = 0; $searchNews = array(); foreach ($searchResult as $result) { if ($result['moduleID'] == $moduleID && $result['languageID'] == $languageID) { $newsSelect = new NewsData(); $select = $newsSelect->select()->where('ND_ID = ?', $result['contentID']); $newsData = $newsSelect->fetchRow($select); $link = Cible_FunctionsCategories::getPagePerCategoryView($result['pageID'], 'details'); if ($newsData['ND_ReleaseDate'] <= date('Y-m-d') && $link != '') { $searchNews[$y]['moduleID'] = $result['moduleID']; $searchNews[$y]['pageID'] = $result['pageID']; $searchNews[$y]['contentID'] = $result['contentID']; $searchNews[$y]['languageID'] = $result['languageID']; $searchNews[$y]['title'] = $result['title']; $searchNews[$y]['text'] = $result['text']; $searchNews[$y]['link'] = $link; $y++; $searchCount++; } array_splice($searchResult, $i, 1); } else { $i++; } } $this->view->assign('searchNews', $searchNews); /* * *************************** */ /* * ********* EVENTS ************* */ $moduleID = 7; $i = 0; $y = 0; $searchEvents = array(); foreach ($searchResult as $result) { if ($result['moduleID'] == $moduleID && $result['languageID'] == $languageID) { $link = Cible_FunctionsCategories::getPagePerCategoryView($result['pageID'], 'details'); if ($link != '') { $searchEvents[$y]['moduleID'] = $result['moduleID']; $searchEvents[$y]['pageID'] = $result['pageID']; $searchEvents[$y]['contentID'] = $result['contentID']; $searchEvents[$y]['languageID'] = $result['languageID']; $searchEvents[$y]['title'] = $result['title']; $searchEvents[$y]['text'] = $result['text']; $searchEvents[$y]['link'] = $link; $y++; $searchCount++; } array_splice($searchResult, $i, 1); } else { $i++; } } $this->view->assign('searchEvents', $searchEvents); /* * *************************** */ /* * ********* NEWSLETTERS ************* */ $moduleID = 8; $i = 0; $y = 0; $searchNewsletters = array(); foreach ($searchResult as $result) { if ($result['moduleID'] == $moduleID && $result['languageID'] == $languageID) { $searchNewsletters[$y]['moduleID'] = $result['moduleID']; $searchNewsletters[$y]['pageID'] = $result['pageID']; $searchNewsletters[$y]['contentID'] = $result['contentID']; $searchNewsletters[$y]['languageID'] = $result['languageID']; $searchNewsletters[$y]['title'] = $result['title']; $searchNewsletters[$y]['text'] = $result['text']; if ($result['link'] == 'release') { $searchNewsletters[$y]['link'] = Cible_FunctionsCategories::getPagePerCategoryView(0, 'details_release', 8) . "/ID/" . $result['contentID']; } else { $searchNewsletters[$y]['link'] = Cible_FunctionsCategories::getPagePerCategoryView(0, 'details_article', 8) . "/ID/" . $result['contentID']; } $y++; $searchCount++; array_splice($searchResult, $i, 1); } else { $i++; } } $this->view->assign('searchNewsletters', $searchNewsletters); /* * *************************** */ /* * ********* GALLERY ************* */ $moduleID = 9; $i = 0; $y = 0; $searchGalleries = array(); $galleryID = array(); foreach ($searchResult as $result) { if ($result['moduleID'] == $moduleID && $result['languageID'] == $languageID) { $link = Cible_FunctionsCategories::getPagePerCategoryView($result['pageID'], 'details', 9); if ($link != '' && !in_array($result['contentID'], $galleryID)) { $searchGalleries[$y]['moduleID'] = $result['moduleID']; $searchGalleries[$y]['pageID'] = $result['pageID']; $searchGalleries[$y]['contentID'] = $result['contentID']; $searchGalleries[$y]['languageID'] = $result['languageID']; $searchGalleries[$y]['title'] = $result['title']; $searchGalleries[$y]['text'] = $result['text']; $galleryID[] = $result['contentID']; /* if($result['link'] == 'image') $searchGalleries[$y]['link'] = $link."/ID/{$result['pageID']}"; else $searchGalleries[$y]['link'] = $link."/ID/{$result['contentID']}"; */ $searchGalleries[$y]['link'] = $link . "/ID/{$result['contentID']}"; $y++; $searchCount++; } array_splice($searchResult, $i, 1); } else { $i++; } } $this->view->assign('searchGalleries', $searchGalleries); $this->view->assign('searchCount', $searchCount); }