예제 #1
0
 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'));
     }
 }
예제 #2
0
 public static function deleteAllBlock($PageID)
 {
     $textSelect = new Blocks();
     $select = $textSelect->select()->setIntegrityCheck(false)->from('Blocks')->where('B_PageID = ?', $PageID)->join('TextData', 'TD_BlockID = B_ID');
     $textData = $textSelect->fetchAll($select);
     foreach ($textData as $text) {
         $indexData['moduleID'] = $text['B_ModuleID'];
         $indexData['contentID'] = $text['TD_ID'];
         $indexData['languageID'] = $text['TD_LanguageID'];
         $indexData['action'] = 'delete';
         Cible_FunctionsIndexation::indexation($indexData);
     }
     $Blocks = new Blocks();
     $Where = "B_PageID = " . $PageID;
     $Blocks->delete($Where);
 }
예제 #3
0
 public function indexAction()
 {
     $Param = $this->_getParam('Param');
     $Action = $Param['action'];
     // if user has an account and is logged
     $islogged = Cible_FunctionsGeneral::getAuthentication();
     Zend_Registry::set('user', $islogged);
     // grab the Id, language and title of the page called
     $Row = $this->_getParam('Row');
     $view_template = $Row['V_Path'];
     Zend_Registry::set('pageID', $Row['PI_PageID']);
     Zend_Registry::set('languageID', $Row['PI_LanguageID']);
     Zend_Registry::set('currentUrlAction', $this->_request->getParam('action'));
     $session = new Cible_Sessions();
     $session->languageID = $Row['PI_LanguageID'];
     Zend_Registry::set('altImageFirst', $Row['PI_AltPremiereImage']);
     Zend_Registry::set('languageSuffix', $Row['L_Suffix']);
     $languageSuffix = $Row['L_Suffix'];
     Zend_Registry::set('pageTitle', $Row['PI_PageTitle']);
     Zend_Registry::set('pageIndex', $Row['PI_PageIndex']);
     Zend_Registry::set('current_theme', $Row['PT_Folder']);
     if (!Zend_Registry::isRegistered('selectedItemMenuLevel')) {
         Zend_Registry::set('selectedItemMenuLevel', 0);
     }
     Zend_Registry::set('config', $this->_config);
     $absolute_web_root = Zend_Registry::get('absolute_web_root');
     // Set Meta Tags
     $this->view->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0');
     $this->view->headMeta()->appendName('Author', 'Cible Solutions d\'Affaires');
     $this->view->headMeta()->appendName('Copyright', 'Cible Solutions d\'Affaires - ' . date('Y'));
     $this->view->headMeta()->appendName('Publisher', 'Cible Solutions d\'Affaires - ' . date('Y'));
     $this->view->headMeta()->appendName('Language', Zend_Registry::get("languageSuffix"));
     $this->view->placeholder('metaOther')->set($Row['PI_MetaOther']);
     $this->view->headMeta()->appendName('Description', $Row['PI_MetaDescription']);
     $this->view->headMeta()->appendName('Keywords', $Row['PI_MetaKeywords']);
     $this->view->headMeta()->appendName('Robots', 'all, noodp');
     $this->view->headMeta()->appendName('Date-Revision-yyyymmdd', date('Ymd'));
     $this->view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
     $this->view->headMeta()->appendHttpEquiv('Content-Language', $languageSuffix . '-ca');
     $this->view->headMeta()->appendHttpEquiv('X-UA-Compatible', 'IE=8');
     $this->view->headMeta()->appendName('DC.Description', $Row['PI_MetaDescription']);
     $this->view->headMeta()->appendName('DC.Subject', $Row['PI_MetaKeywords']);
     $this->view->headMeta()->appendName('DC.format', 'text/html');
     $this->view->headMeta()->appendName('DC.language', $languageSuffix . '-ca', array('scheme' => 'RFC3066'));
     $clientLogo = $this->_config->clientLogo->src;
     Zend_Registry::set('addThis', "{$absolute_web_root}/themes/default/images/{$languageSuffix}/{$clientLogo}");
     $this->view->assign('showTitle', $Row['P_ShowTitle']);
     $this->view->assign('selectedPage', $Row['PI_PageIndex']);
     $this->view->assign('imgHeader', $Row['PI_TitleImageSrc']);
     $this->view->assign('PI_Secure', $Row['PI_Secure']);
     $this->view->assign('PI_TitleImageAlt', $Row['PI_TitleImageAlt']);
     $currentPageID = $Row['PI_PageID'];
     // finds the current page layout and swap it
     $layout_file = Cible_FunctionsPages::getLayoutPath($currentPageID);
     $this->_helper->layout->setLayout(str_replace('.phtml', '', $layout_file));
     // put the baseurl on a registry key
     Zend_Registry::set('baseUrl', $this->getFrontController()->getBaseUrl());
     // display the page title on the website
     if (!empty($Row['PI_MetaTitle'])) {
         $this->view->headTitle($Row['PI_MetaTitle']);
         $this->view->headMeta()->appendName('DC.title', $Row['PI_MetaTitle']);
     } else {
         $this->view->headTitle($this->_config->site->title);
         $this->view->headTitle()->setSeparator(' > ');
         $this->view->headTitle(Zend_Registry::get("pageTitle"));
     }
     // display metadata on the website
     $this->view->metaDescription = $Row['PI_MetaDescription'];
     $this->view->metaKeywords = $Row['PI_MetaKeywords'];
     $this->view->pageTitle = $Row['PI_PageTitle'];
     // 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('Parameters', 'Parameters.P_BlockID = Blocks.B_ID', array('B_Action' => 'P_Value'))->where('Parameters.P_Number  = ?', 999)->where('Blocks.B_PageID = ?', Zend_Registry::get("pageID"))->where('Blocks.B_Online = ?', 1)->order('Blocks.B_Position ASC');
     //        if (!$islogged)
     //            $Select->where ('B_Secured = ?', 0);
     $Rows = $Blocks->fetchAll($Select);
     // Actions to be called in the view for rendering the page's blocks
     $blocks = array();
     // for all blocks to display, call the proper controller module
     foreach ($Rows as $Row) {
         $Module = $Row['M_MVCModuleTitle'];
         $ActionIndex = $Row['B_Action'];
         $Param['BlockID'] = $Row['B_ID'];
         $Param['secured'] = $Row['B_Secured'];
         if (!isset($blocks[$Row['B_ZoneID']])) {
             $blocks[$Row['B_ZoneID']] = array();
         }
         array_push($blocks[$Row['B_ZoneID']], array('action' => $ActionIndex, 'controller' => 'index', 'module' => $Module, 'params' => $Param));
     }
     $this->view->assign('blocks', $blocks);
     $this->view->assign('view_template', $view_template);
     $this->view->assign('currentPageID', $currentPageID);
     $this->view->assign('absolute_web_root', $absolute_web_root);
     $i = 0;
     foreach ($this->_config->themes->default->styles as $style) {
         if (!is_null($style->ie_version)) {
             $this->view->headLink()->offsetSetStylesheet(200 + $i, "{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media, $style->ie_version);
             $this->view->headLink()->prependStylesheet("{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media, $style->ie_version);
         } else {
             $this->view->headLink()->offsetSetStylesheet(1, "{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media);
             $this->view->headLink()->prependStylesheet("{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media);
         }
         $i++;
     }
     $this->view->headLink(array('rel' => 'canonical', 'href' => $absolute_web_root . $this->_request->getPathInfo()));
     if ($this->_config->fontController->embeded) {
         $this->view->headScript()->appendFile($this->view->locateFile('font-controller.js', 'jquery'));
         $this->view->headScript()->appendFile($this->view->locateFile('jquery.cookie.js', 'jquery'));
     }
     if ($this->_config->addthisWidget->embeded) {
         $this->view->headScript()->appendFile($this->view->locateFile('addthis_widget.js'));
     }
     if ($this->_config->setBgStyle) {
         $this->view->setBgStyle();
     }
 }
예제 #4
0
 public function editAction()
 {
     $this->view->title = "Modification d'un texte";
     if ($this->view->aclIsAllowed('text', 'edit', true)) {
         $_blockID = $this->_getParam('blockID');
         $_pageid = $this->_getParam('pageID');
         $_id = $this->_getParam('ID');
         $base_dir = $this->getFrontController()->getBaseUrl();
         $blockText = new Text();
         $select = $blockText->select();
         $select->where('TD_BlockID = ?', $_blockID);
         $select->where('TD_LanguageID = ?', $this->_currentEditLanguage);
         $block = $blockText->fetchRow($select);
         $blockSelect = new Blocks();
         $selectBloc = $blockSelect->select()->setIntegrityCheck(false)->from('Blocks')->where('B_ID = ?', $_blockID)->join('PagesIndex', 'PI_PageID = B_PageID')->where('PI_LanguageID = ?', $block['TD_LanguageID']);
         // If block doesn't exist, creates it.
         if (empty($block)) {
             $block = $blockText->createRow(array('TD_BlockID' => $_blockID, 'TD_LanguageID' => $this->_currentEditLanguage));
             $block->save();
             // load it
             $block = $blockText->fetchRow($select);
         }
         if ($_id) {
             $returnLink = "{$base_dir}/text/index/list-approbation-request/";
         } else {
             $returnLink = "{$base_dir}/page/index/index/ID/{$_pageid}";
         }
         $form = new FormText(array('baseDir' => $base_dir, 'pageID' => $_pageid, 'cancelUrl' => $returnLink, 'toApprove' => $block["TD_ToApprove"]));
         if (!$this->_request->isPost()) {
             $block_data = empty($block) ? array() : $block->toArray();
             $blockData = $blockSelect->fetchRow($selectBloc);
             $block_data['PI_PageTitle'] = $blockData['PI_PageTitle'];
             $form->populate($block_data);
         } else {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 if (isset($_POST['submitSaveSubmit'])) {
                     $block['TD_ToApprove'] = 1;
                     //header("location:".$returnLink);
                 } elseif (isset($_POST['submitSaveReturnWriting'])) {
                     $block['TD_ToApprove'] = 0;
                     //header("location:".$returnLink);
                 } elseif (isset($_POST['submitSaveOnline'])) {
                     $block['TD_OnlineTitle'] = $formData['TD_DraftTitle'];
                     $block['TD_OnlineText'] = $formData['TD_DraftText'];
                     $block['TD_ToApprove'] = 0;
                     //header("location:".$returnLink);
                     // index the new text if block online
                     $blockData = $blockSelect->fetchRow($selectBloc);
                     if ($blockData['B_Online'] == 1 && $blockData['PI_Status'] == 1) {
                         $indexData['pageID'] = $blockData['B_PageID'];
                         $indexData['moduleID'] = $blockData['B_ModuleID'];
                         $indexData['contentID'] = $block['TD_ID'];
                         $indexData['languageID'] = $block['TD_LanguageID'];
                         $indexData['title'] = $blockData['PI_PageTitle'];
                         $indexData['text'] = '';
                         $indexData['link'] = '';
                         $indexData['contents'] = $blockData['PI_PageTitle'] . " " . $block['TD_OnlineText'];
                         $indexData['action'] = 'update';
                         Cible_FunctionsIndexation::indexation($indexData);
                     }
                 } else {
                     $returnLink = "";
                 }
                 $block['TD_DraftTitle'] = $formData['TD_DraftTitle'];
                 $block['TD_DraftText'] = $formData['TD_DraftText'];
                 $block->save();
                 $oPage = new PagesObject();
                 $pageData['P_ID'] = $_pageid;
                 $pageData['PI_PageTitle'] = $formData['PI_PageTitle'];
                 $oPage->save($_pageid, $pageData, $this->_currentEditLanguage);
                 //if($returnLink <> "")
                 //$this->_redirect("/page/index/index/ID/$_pageid");
             }
         }
         $this->view->assign('form', $form);
         $this->view->assign('pageId', $_pageid);
         $this->view->assign('onlineTitle', isset($block['TD_OnlineTitle']) ? $block['TD_OnlineTitle'] : '');
         $this->view->assign('onlineText', isset($block['TD_OnlineText']) ? $block['TD_OnlineText'] : '');
     }
 }