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')); } }
private function autogenerateMenuItemFromPageId($itemId, $parentId, $recursive = false) { $pageObject = new Pages(); $select = $pageObject->select()->setIntegrityCheck(false)->from('Pages')->joinInner('PagesIndex', 'PI_PageID = P_ID')->where('PI_LanguageID = ?', Zend_Registry::get('languageID'))->where('P_ParentID = ?', $parentId)->order('P_Position'); $pages = $pageObject->fetchAll($select)->toArray(); foreach ($pages as $item) { $page_id = $item['P_ID']; $position = $this->_db->fetchCol("SELECT count(*) FROM MenuItemData WHERE MID_ParentID = '{$itemId}' AND MID_MenuID = '{$this->_id}'"); $position = $position[0]; $langs = Cible_FunctionsGeneral::getAllLanguage(); foreach ($langs as $lang) { $page_details = Cible_FunctionsPages::getPageDetails($page_id, $lang['L_ID']); $page_title = !empty($page_details['PI_PageTitle']) ? $page_details['PI_PageTitle'] : null; if ($page_title != null) { $found_status = $this->autogenerate_checkIfAlreadyExists($itemId, $page_id, $lang['L_ID']); if (!$found_status['data']) { $menuData = new MenuItem(); $_data = $menuData->createRow(); $_data->setFromArray(array('MID_MenuID' => $this->_id, 'MID_ParentID' => $itemId, 'MID_Position' => $position)); $_data->save(); $_dataId = $this->_db->lastInsertId(); $menuIndex = new MenuItemIndex(); $_index = $menuIndex->createRow(); $_index->setFromArray(array('MII_LanguageID' => $item['PI_LanguageID'], 'MII_MenuItemDataID' => $_dataId, 'MII_Title' => $page_title, 'MII_Link' => '', 'MII_PageID' => $page_id)); $_index->save(); } else { if ($found_status['data'] && !$found_status['lang']) { $_dataId = $found_status['dataID']; $menuIndex = new MenuItemIndex(); $_index = $menuIndex->createRow(); $_index->setFromArray(array('MII_LanguageID' => $lang['L_ID'], 'MII_MenuItemDataID' => $_dataId, 'MII_Title' => $page_title, 'MII_Link' => '', 'MII_PageID' => $page_id)); $_index->save(); } } } } if ($_dataId != -1 && $recursive) { $this->autogenerateMenuItemFromPageId($_dataId, $page_id, $recursive); } } }
public static function getHomePageDetails() { $pagesSelect = new Pages(); $select = $pagesSelect->select()->setIntegrityCheck(false)->from('Pages')->join('PagesIndex', 'PI_PageID = P_ID')->where('PI_LanguageID = ?', Zend_Registry::get('languageID'))->where('P_Home = 1'); return $pagesSelect->fetchRow($select)->toArray(); }
<?php require_once 'config.php'; $meta = Meta::select('section', $_GET['name_en']); $pages = Pages::select($_GET['name_en']); include 'view/tpl_top.php'; include 'view/tpl_header.php'; include 'view/tpl_nav.php'; ?> <div class="container main-container"> <div class="row"> <div class="col-lg-9 col-md-9 col-sm-12"> <div class="col-lg-12 col-sm-12"> <span class="title"><?php echo $pages[0]['name']; ?> </span> </div> <div class="col-lg-12 col-sm-12 hero-feature"> <?php echo $pages[0]['text']; ?> <?php if ($_GET['name_en'] == "contact") { echo Config::maps(); } elseif ($_GET['name_en'] == "certificate") { ?> <div class="col-lg-4 col-sm-4 hero-feature text-center"> <div class="thumbnail"> <a class="fancybox link-p cat" href="/images/certificate/1/1.jpg" data-fancybox-group="gallery1" style="overflow: hidden; position: relative;"> <img src="/images/certificate/1/1.jpg" style="position: absolute; width: 242px; height: 346px; max-width: none; max-height: none; left: 0px; top: 0px;" class="def-img">