/** * Principal function to build the language navigation * * 1- Get all links of the current page into other languages than the current one * 2- If no links to other language for the current page, show links to the home page * 3- Return the result to the main view * * @author Alexandre Beaudet <*****@*****.**> */ public function navigationLanguage() { $_baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); // get all links to the current page in another language $Pages = new PagesIndex(); $Select = $Pages->select()->setIntegrityCheck(false); $Select->from('PagesIndex'); $Select->join('Languages', 'Languages.L_ID = PagesIndex.PI_LanguageID'); $Select->where('PagesIndex.PI_LanguageID <> ?', Zend_Registry::get("languageID")); $Select->where('PagesIndex.PI_PageID = ?', Zend_Registry::get("pageID")); $Select->where('PagesIndex.PI_Status = ?', 'en ligne'); $Select->order('Languages.L_Title ASC'); $Rows = $Pages->fetchAll($Select); // build the language navigation to display $navigationlangue = "<ul class='navigationlanguage'>"; if ($Rows->count() > 0) { foreach ($Rows as $Row) { $navigationlangue .= "<li><a href='" . $baseUrl . "/" . $Row['PI_PageIndex'] . "'>" . $Row['L_Title'] . "</a></li>"; } } else { // get all links to the home page in another language $Languages = Zend_Registry::get("db"); $Select = $Languages->select()->from('Languages')->join('PagesIndex', 'PagesIndex.PI_LanguageID = Languages.L_ID')->where('Languages.L_ID <> ?', Zend_Registry::get("languageID"))->where('PagesIndex.PI_PageID = ?', '0')->where('PagesIndex.PI_Status = ?', 'en ligne')->order('Languages.L_Title'); $Rows = $Languages->fetchAll($Select); foreach ($Rows as $Row) { $navigationlangue .= "<li><a href='" . $_baseUrl . "/" . $Row['PI_PageIndex'] . "'>" . $Row['L_Title'] . "</a></li>"; } } $navigationlangue .= "</ul>"; return $navigationlangue; }
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(); } }
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')); } }
public static function indexationBuild() { set_time_limit(0); /* * ****** PAGE ******* */ $pageSelect = new PagesIndex(); $select = $pageSelect->select()->where('PI_Status = 1'); $pageData = $pageSelect->fetchAll($select)->toArray(); $cpt = count($pageData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $pageData[$i]['PI_PageID']; $indexData['moduleID'] = 0; $indexData['contentID'] = $pageData[$i]['PI_PageID']; $indexData['languageID'] = $pageData[$i]['PI_LanguageID']; $indexData['title'] = $pageData[$i]['PI_PageTitle']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $pageData[$i]['PI_PageTitle']; Cible_FunctionsIndexation::indexation($indexData); } /* * ****** TEXT ******* */ if (class_exists('Text', false)) { $textSelect = new Text(); $select = $textSelect->select()->setIntegrityCheck(false)->from('TextData', array('ID' => 'TD_ID', 'LanguageID' => 'TD_LanguageID', 'Text' => 'TD_OnlineText'))->join('Blocks', 'B_ID = TD_BlockID', array('BlockID' => 'B_ID', 'ModuleID' => 'B_ModuleID'))->where('B_Online = 1')->join('PagesIndex', 'PI_PageID = B_PageID', array('PageID' => 'PI_PageID', 'Title' => 'PI_PageTitle'))->where('PI_Status = 1')->where('PI_LanguageID = TD_LanguageID'); $textData = $textSelect->fetchAll($select)->toArray(); $cpt = count($textData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $textData[$i]['PageID']; $indexData['moduleID'] = $textData[$i]['ModuleID']; $indexData['contentID'] = $textData[$i]['ID']; $indexData['languageID'] = $textData[$i]['LanguageID']; $indexData['title'] = $textData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $textData[$i]['Title'] . " " . $textData[$i]['Text']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** NEWS ******* */ if (class_exists('NewsData', false)) { $newsSelect = new NewsData(); $select = $newsSelect->select()->setIntegrityCheck(false)->from('NewsData', array('NewsID' => 'ND_ID', 'CategoryID' => 'ND_CategoryID'))->join('NewsIndex', 'NI_NewsDataID = ND_ID', array('LanguageID' => 'NI_LanguageID', 'NewsTitle' => 'NI_Title', 'NewsBrief' => 'NI_Brief', 'NewsText' => 'NI_Text', 'NewsImageAlt' => 'NI_ImageAlt'))->where('NI_Status = 1'); $newsData = $newsSelect->fetchAll($select); $cpt = count($newsData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsData[$i]['CategoryID']; $indexData['moduleID'] = 2; $indexData['contentID'] = $newsData[$i]['NewsID']; $indexData['languageID'] = $newsData[$i]['LanguageID']; $indexData['title'] = $newsData[$i]['NewsTitle']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $newsData[$i]['NewsTitle'] . " " . $newsData[$i]['NewsBrief'] . " " . $newsData[$i]['NewsText'] . " " . $newsData[$i]['NewsImageAlt']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** EVENTS ******* */ if (class_exists('EventsIndex', false)) { $eventsSelect = new EventsIndex(); $select = $eventsSelect->select()->setIntegrityCheck(false)->from('EventsIndex', array('ID' => 'EI_EventsDataID', 'LanguageID' => 'EI_LanguageID', 'Title' => 'EI_Title', 'Brief' => 'EI_Brief', 'Text' => 'EI_Text', 'ImageAlt' => 'EI_ImageAlt'))->join('EventsData', 'ED_ID = EI_EventsDataID', array('CategoryID' => 'ED_CategoryID'))->where('EI_Status = 1'); $eventsData = $eventsSelect->fetchAll($select)->toArray(); $cpt = count($eventsData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $eventsData[$i]['CategoryID']; $indexData['moduleID'] = 7; $indexData['contentID'] = $eventsData[$i]['ID']; $indexData['languageID'] = $eventsData[$i]['LanguageID']; $indexData['title'] = $eventsData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $eventsData[$i]['Title'] . " " . $eventsData[$i]['Brief'] . " " . $eventsData[$i]['Text'] . " " . $eventsData[$i]['ImageAlt']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** GALLERY ******* */ if (class_exists('Galleries', false)) { $gallerySelect = new Galleries(); $select = $gallerySelect->select()->setIntegrityCheck(false)->from('Galleries', array('ID' => 'G_ID', 'CategoryID' => 'G_CategoryID'))->where('G_Online = 1')->join('GalleriesIndex', 'GI_GalleryID = G_ID', array('LanguageID' => 'GI_LanguageID', 'Title' => 'GI_Title', 'Description' => 'GI_Description'))->join('ImagesIndex', 'II_ImageID = G_ImageID', array('ImageTitle' => 'II_Title', 'ImageDescription' => 'II_Description'))->where('II_LanguageID = GI_LanguageID'); $galleryData = $gallerySelect->fetchAll($select); $cpt = count($galleryData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $galleryData[$i]['CategoryID']; $indexData['moduleID'] = 9; $indexData['contentID'] = $galleryData[$i]['ID']; $indexData['languageID'] = $galleryData[$i]['LanguageID']; $indexData['title'] = $galleryData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = 'gallery'; $indexData['contents'] = $galleryData[$i]['Title'] . " " . $galleryData[$i]['Description'] . " " . $galleryData[$i]['ImageTitle'] . " " . $galleryData[$i]['ImageDescription']; Cible_FunctionsIndexation::indexation($indexData); $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images', array('ID' => 'GI_ImageID'))->where('GI_GalleryID = ?', $galleryData[$i]['ID'])->where('GI_Online = 1')->join('ImagesIndex', 'II_ImageID = GI_ImageID', array('LanguageID' => 'II_LanguageID', 'Title' => 'II_Title', 'Description' => 'II_Description')); $imagesData = $imagesSelect->fetchAll($select); $cptImage = count($imagesData); for ($y = 0; $y < $cptImage; $y++) { $indexData['action'] = "add"; $indexData['pageID'] = $galleryData[$i]['CategoryID']; $indexData['moduleID'] = 9; $indexData['contentID'] = $galleryData[$i]['ID']; $indexData['languageID'] = $imagesData[$y]['LanguageID']; $indexData['title'] = $imagesData[$y]['Title']; $indexData['text'] = ''; $indexData['link'] = 'image'; $indexData['contents'] = $imagesData[$y]['Title'] . " " . $imagesData[$y]['Description']; Cible_FunctionsIndexation::indexation($indexData); } } } /* * ********************* */ /* * ****** NEWSLETTERS ******* */ if (class_exists('NewsletterRelease', false)) { $newsletterSelect = new NewsletterReleases(); $select = $newsletterSelect->select()->from('Newsletter_Releases', array('ID' => 'NR_ID', 'LanguageID' => 'NR_LanguageID', 'Title' => 'NR_Title'))->where('NR_Online = 1'); $newsletterData = $newsletterSelect->fetchAll($select)->toArray(); $cpt = count($newsletterData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsletterData[$i]['ID']; $indexData['moduleID'] = 8; $indexData['contentID'] = $newsletterData[$i]['ID']; $indexData['languageID'] = $newsletterData[$i]['LanguageID']; $indexData['title'] = $newsletterData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = 'release'; $indexData['contents'] = $newsletterData[$i]['Title']; Cible_FunctionsIndexation::indexation($indexData); $articlesSelect = new NewsletterArticles(); $select = $articlesSelect->select()->from('Newsletter_Articles', array('ID' => 'NA_ID', 'Title' => 'NA_Title', 'Resume' => 'NA_Resume', 'Text' => 'NA_Text'))->where('NA_ReleaseID = ?', $newsletterData[$i]['ID']); $articlesData = $articlesSelect->fetchAll($select); $cptArticle = count($articlesData); for ($y = 0; $y < $cptArticle; $y++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsletterData[$i]['ID']; $indexData['moduleID'] = 8; $indexData['contentID'] = $articlesData[$y]['ID']; $indexData['languageID'] = $newsletterData[$i]['LanguageID']; $indexData['title'] = $articlesData[$y]['Title']; $indexData['text'] = ''; $indexData['link'] = 'article'; $indexData['contents'] = $articlesData[$y]['Title'] . " " . $articlesData[$y]['Resume'] . " " . $articlesData[$y]['Text']; Cible_FunctionsIndexation::indexation($indexData); } } } /* * ********************* */ }
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 static function deleteAllChildPage($ParentID) { if ($ParentID != 0) { $Pages = new Pages(); $Select = $Pages->select()->where("P_ParentID = ?", $ParentID); $PageArray = $Pages->fetchAll($Select); foreach ($PageArray as $Page) { $PageID = $Page["P_ID"]; 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); } $PageObj = new Pages(); $Where = 'P_ID = ' . $PageID; $PageObj->delete($Where); $PageIndex = new PagesIndex(); $Where = 'PI_PageID = ' . $PageID; $PageIndex->delete($Where); //echo("DELETE PAGE : ".$Page["P_ID"]."<br/>"); //echo("DELETE PAGEINDEX : ".$Page["P_ID"]."<br/>"); } } }
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); }