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); } } } /* * ********************* */ }
public function detailsAction() { $numberOfImagesPerPage = 5; $numberOfImagesPerColumn = 4; $gallery = new GalleryObject(); $blockID = $this->_getParam('BlockID'); $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $regularDetailsShow = true; if (isset($blockParameters[1]['P_Value'])) { if ($blockParameters[1]['P_Number'] != 999) { if ($blockParameters[1]['P_Value'] != 0) { $regularDetailsShow = false; } } } /*if(!empty($_SERVER['HTTP_REFERER'])){ $this->view->assign('pagePrecedente', $_SERVER['HTTP_REFERER']); } else{ $this->view->assign('pagePrecedente',''); }*/ //$this->view->assign('pagePrecedente',''); $listall_page = Cible_FunctionsCategories::getPagePerCategoryView(9001, 'list'); $this->view->assign('listall_page_gallery', $listall_page); if ($regularDetailsShow == false) { $id = 0; $idGallery = $blockParameters[1]['P_Value']; $titleUrl = Cible_FunctionsGeneral::getTitleFromPath($this->_request->getPathInfo(), true); $baseDir = $this->view->baseUrl(); $config = Zend_Registry::get('config')->toArray(); $imageId = $idGallery; // $this->view->headLink()->appendStylesheet($baseDir . '/themes/default/css/prettyPhoto.css', 'screen'); $galleryID = $idGallery; $db = Zend_Registry::get('db'); $gallerySelect = new GalleriesIndex(); $select = $db->select()->distinct()->from('GalleriesIndex')->joinRight('Galleries', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID); $galleryData = $db->fetchRow($select); //var_dump($galleryData); if (count($galleryData) > 0) { $this->view->headTitle($galleryData['GI_Title']); $originalMaxHeight = $config['gallery']['image']['original']['maxHeight']; $originalMaxWidth = $config['gallery']['image']['original']['maxWidth']; $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->join('Images', 'I_ID = GI_ImageID')->joinLeft('ImagesIndex', 'II_ImageID = I_ID AND II_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID)->where('GI_Online = 1')->order('GI_Position'); $imagesData = $imagesSelect->fetchAll($select)->toArray(); $i = 0; foreach ($imagesData as $image) { $imagesData[$i]['thumbName'] = str_replace($image['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $imagesData[$i]['originalName'] = str_replace($image['I_OriginalLink'], $originalMaxWidth . 'x' . $originalMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $i++; } $this->view->assign('galleryData', $galleryData); $this->view->assign('imagesData', $imagesData); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($imagesData)); $paginator->setItemCountPerPage($numberOfImagesPerPage); $pageNum = $this->_request->getParam('page'); if ($pageNum == "") { $pageNum = Cible_FunctionsGeneral::getPageNumberWithoutParamOrder($this->_request->getPathInfo()); } //var_dump($paginator); $paginator->setCurrentPageNumber($pageNum); $this->view->assign('paginator', $paginator); $this->view->assign('numberItemPerColumn', $numberOfImagesPerColumn); } } else { $id = 0; $idGallery = 0; $titleUrl = Cible_FunctionsGeneral::getTitleFromPath($this->_request->getPathInfo(), true); if ($titleUrl != "") { $idGallery = $gallery->getIdByName($titleUrl); } $baseDir = $this->view->baseUrl(); $config = Zend_Registry::get('config')->toArray(); $imageId = $idGallery; // $this->view->headLink()->appendStylesheet($baseDir . '/themes/default/css/prettyPhoto.css', 'screen'); $galleryID = $idGallery; $db = Zend_Registry::get('db'); $gallerySelect = new GalleriesIndex(); $select = $db->select()->distinct()->from('GalleriesIndex')->joinRight('Galleries', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID); $galleryData = $db->fetchRow($select); //echo $select; //var_dump($galleryData); if (count($galleryData) > 0) { $this->view->headTitle($galleryData['GI_Title']); $originalMaxHeight = $config['gallery']['image']['original']['maxHeight']; $originalMaxWidth = $config['gallery']['image']['original']['maxWidth']; $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->join('Images', 'I_ID = GI_ImageID')->joinLeft('ImagesIndex', 'II_ImageID = I_ID AND II_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID)->where('GI_Online = 1')->order('GI_Position'); $imagesData = $imagesSelect->fetchAll($select)->toArray(); $i = 0; foreach ($imagesData as $image) { $imagesData[$i]['thumbName'] = str_replace($image['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $imagesData[$i]['originalName'] = str_replace($image['I_OriginalLink'], $originalMaxWidth . 'x' . $originalMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $i++; } $this->view->assign('galleryData', $galleryData); $this->view->assign('imagesData', $imagesData); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($imagesData)); $paginator->setItemCountPerPage($numberOfImagesPerPage); $pageNum = $this->_request->getParam('page'); if ($pageNum == "") { $pageNum = Cible_FunctionsGeneral::getPageNumberWithoutParamOrder($this->_request->getPathInfo()); } //var_dump($paginator); $paginator->setCurrentPageNumber($pageNum); $this->view->assign('paginator', $paginator); $this->view->assign('numberItemPerColumn', $numberOfImagesPerColumn); } } }
public function deleteAction() { // web page title $this->view->title = "Suppression d'une galerie"; //if ($this->view->aclIsAllowed('gallery','manage',true)){ // variables $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->view->assign('success', false); $pageID = (int) $this->_getParam('pageID'); $blockID = (int) $this->_getParam('blockID'); $galleryID = (int) $this->_getParam('galleryID'); if ($blockID != '') { $return = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"; } elseif ($this->_categoryID) { $return = "/gallery/index/list/catID/{$this->_categoryID}"; } else { $return = "/gallery/index/list/"; } $this->view->return = $this->view->baseUrl() . $return; $galleryObject = new GalleryObject(); $galleryDataIndex = $galleryObject->populate($galleryID, $this->_defaultEditLanguage); if (!$galleryDataIndex) { if ($this->_request->isPost()) { $this->view->assign('success', true); } $this->view->assign('deleted', true); $this->view->assign('galleryID', $galleryID); } else { $this->view->assign('deleted', false); $this->view->gallery = $galleryDataIndex; if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($galleryDataIndex) { $gallerySelect = new GalleriesIndex(); $select = $gallerySelect->select()->where('GI_GalleryID = ?', $galleryID); $galleryData = $gallerySelect->fetchAll($select); foreach ($galleryData as $gallery) { $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $galleryID; $indexData['languageID'] = $gallery['GI_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); $imageSelect = new GalleriesImages(); $select = $imageSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->where('GI_GalleryID = ?', $galleryID)->join('ImagesIndex', 'II_ImageID = GI_ImageID')->where('II_LanguageID = ?', $gallery['GI_LanguageID']); $imageData = $imageSelect->fetchAll($select)->toArray(); $cpt = count($imageData); for ($i = 0; $i < $cpt; $i++) { $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $imageData[$i]['II_ImageID']; $indexData['languageID'] = $imageData[$i]['II_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); } } //delete all images associated with the gallery $galleryImagesSelect = new GalleriesImages(); $select = $galleryImagesSelect->select()->where('GI_GalleryID = ?', $galleryID); $galleryImagesData = $galleryImagesSelect->fetchAll($select); foreach ($galleryImagesData as $galleryImages) { $imageDelete = new Images(); $where = "I_ID = " . $galleryImages['GI_ImageID']; $imageDelete->delete($where); $imageIndexDelete = new ImagesIndex(); $where = "II_ImageID = " . $galleryImages['GI_ImageID']; $imageIndexDelete->delete($where); } $galleryImagesDelete = new GalleriesImages(); $where = "GI_GalleryID = " . $galleryID; $galleryImagesDelete->delete($where); $galleryObject->delete($galleryID); /* //delete the gallery $galleryDelete = new Galleries(); $where = 'G_ID = ' . $galleryID; $galleryDelete->delete($where); $galleryIndexDelete = new GalleriesIndex(); $where = 'GI_GalleryID = ' . $galleryID; $galleryIndexDelete->delete($where); */ //delete the gallery folder Cible_FunctionsGeneral::delFolder("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID); if (!$this->_isXmlHttpRequest) { if ($blockID != '') { $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"); } elseif ($this->_categoryID) { $this->_redirect("/gallery/index/list/catID/{$this->_categoryID}"); } else { $this->_redirect("/gallery/index/list/"); } } else { $buttonAction = $formData['buttonAction']; $this->view->assign('success', true); $this->view->assign('buttonAction', $buttonAction); $this->view->assign('galleryID', $galleryID); $this->view->assign('deleted', true); } } } } //} }
function deleteAction() { $this->view->title = "Suppression d'une image"; //if ($this->view->aclIsAllowed('gallery','manage',true)){ $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->view->assign('success', false); $pageID = (int) $this->_getParam('pageID'); $blockID = (int) $this->_getParam('blockID'); $galleryID = (int) $this->_getParam('galleryID'); $imageID = (int) $this->_getParam('imageID'); $imageIndexSelect = new ImagesIndex(); $select = $imageIndexSelect->select()->where('II_ImageID = ?', $imageID); $imageIndexData = $imageIndexSelect->fetchRow($select); if (!$imageIndexData) { if ($this->_request->isPost()) { $this->view->assign('success', true); } $this->view->assign('deleted', true); $this->view->assign('imageID', $imageID); } else { $imageObject = new ImageObject(); $imageIndexData = $imageObject->populate($imageID, Zend_Registry::get("languageID")); //$imageIndexData = $imageObject->populate($imageID,$this->_defaultEditLanguage); $this->view->assign('deleted', false); $return = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"; $this->view->return = $this->view->baseUrl() . $return; $this->view->image = $imageIndexData; if ($this->_request->isPost()) { //$del = $this->_request->getPost('delete'); //if ($del && $imageIndexData) { if ($imageIndexData) { $imageSelect = new ImagesIndex(); $select = $imageSelect->select()->where('II_ImageID = ?', $imageID); $imageData = $imageSelect->fetchAll($select)->toArray(); $cpt = count($imageData); for ($i = 0; $i < $cpt; $i++) { $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $imageData[$i]['II_ImageID']; $indexData['languageID'] = $imageData[$i]['II_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); } $imageObject->delete($imageID); $galleryImageDelete = new GalleriesImages(); $where = 'GI_GalleryID = ' . $galleryID . " and GI_ImageID = " . $imageID; $galleryImageDelete->delete($where); //delete the gallery folder Cible_FunctionsGeneral::delFolder("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/" . $imageID); if (!$this->_isXmlHttpRequest) { $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"); } else { $this->view->assign('success', true); $this->view->assign('imageID', $imageID); } } //$this->_redirect($return); } } //} }