Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 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);
             }
         }
     }
 }
Ejemplo n.º 3
0
 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);
             }
         }
     }
     /*         * ********************* */
 }
Ejemplo n.º 4
0
 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/>");
         }
     }
 }