public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel($this->getView()->getCibleText('form_gallery_blockCategory_label'))->setAttrib('class', 'largeSelect')->setOrder(11); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 9)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($blockCategory); $blockGallery = new Zend_Form_Element_Select('Param2'); $blockGallery->setLabel($this->getView()->getCibleText('form_gallery_blockGallerey_label'))->setAttrib('class', 'largeSelect')->setOrder(12); $galleries = new Galleries(); $selectG = $galleries->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->where('G_Online = 1')->where('GI_LanguageID = ?', Zend_Registry::get("languageID"))->order('GI_Title'); $galleriesArray = $galleries->fetchAll($selectG); //echo $selectG; $blockGallery->addMultiOption('0', $this->getView()->getCibleText('form_gallery_blockGallerey_None')); foreach ($galleriesArray as $gallery) { $blockGallery->addMultiOption($gallery['GI_GalleryID'], $gallery['GI_Title']); } $this->addElement($blockGallery); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); }
public function listAction() { $this->view->title = "Liste des galleries"; if ($this->view->aclIsAllowed('gallery', 'manage', true)) { // variables $this->view->params = $this->_getAllParams(); $blockID = $this->_getParam('blockID'); $pageID = $this->_getParam('pageID'); $baseDir = $this->view->baseUrl(); $base = substr($baseDir, 0, strpos($baseDir, "/{$this->_config->document_root}/")); if ($blockID != '') { $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $this->_categoryID = $blockParameters[0]['P_Value']; } $this->view->headScript()->appendFile($baseDir . '/js/jquery.json-1.3.min.js'); $this->view->headScript()->appendFile($baseDir . '/js/tiny_mce/plugins/imagemanager/js/mcimagemanager.js'); //get category details $this->view->categoryDetails = Cible_FunctionsCategories::getCategoryDetails($this->_categoryID); // get all galleries $galleriesSelect = new Galleries(); $select = $galleriesSelect->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->join('Images', 'G_ImageID = I_ID')->where('GI_LanguageID = ?', $this->_defaultEditLanguage)->order('G_Position')->order('GI_Title'); if ($this->_categoryID > 0) { $select->where('G_CategoryID = ?', $this->_categoryID); } $galleriesData = $galleriesSelect->fetchAll($select); $this->view->galleriesData = $galleriesData->toArray(); $this->view->imagesAjaxLink = "{$baseDir}/gallery/index/list-all-images"; if ($blockID != '') { $this->view->imagesEditLink = "{$baseDir}/gallery/image/edit/blockID/{$blockID}"; } else { $this->view->imagesEditLink = "{$baseDir}/gallery/image/edit"; } $this->view->imagesDeleteLink = "{$baseDir}/gallery/image/delete"; /* $galleriesImages = new GalleriesImages(); $select = $galleriesImages->select()->setIntegrityCheck(false) ->from('Galleries_Images') ->join('ImagesIndex', 'II_ImageID = GI_ImageID') ->where('GI_GalleryID = ?', $galleryID); $ImagesData = $galleriesImages->fetchAll($select); */ } }
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 listAction() { $blockID = $this->_getParam('BlockID'); $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $categoryID = $blockParameters[0]['P_Value']; $galleriesSelect = new Galleries(); $select = $galleriesSelect->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->join('Images', 'I_ID = G_ImageID')->where('G_CategoryID = ?', $categoryID)->where('G_Online = 1')->order('G_Position'); $galleriesData = $galleriesSelect->fetchAll($select)->toArray(); $config = Zend_Registry::get('config')->toArray(); $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $i = 0; foreach ($galleriesData as $gallery) { $galleriesData[$i]['I_ThumbLink'] = str_replace($gallery['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $gallery['I_OriginalLink'], $gallery['I_OriginalLink']); $galleriesData[$i]['linkDetails'] = Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details', 9); $i++; } // var_dump($galleriesData); $details_page = Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details', 9); $this->view->assign('details_page', $details_page); $this->view->assign('galleriesData', $galleriesData); }
function editAction() { $this->view->title = "Modification d'une image"; //if ($this->view->aclIsAllowed('gallery','manage',true)){ $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->view->assign('success', false); $pageID = $this->_getParam('pageID'); $blockID = $this->_getParam('blockID'); $imageID = $this->_getParam('imageID'); $baseDir = $this->view->baseUrl(); $imageSelect = new ImagesIndex(); $select = $imageSelect->select()->setIntegrityCheck(false)->from('ImagesIndex')->join('Galleries_Images', 'GI_ImageID = II_ImageID')->where('II_ImageID = ?', $imageID); $imageData = $imageSelect->fetchRow($select); if (!$imageData) { if ($this->_request->isPost()) { $this->view->assign('success', true); } $this->view->assign('deleted', true); $this->view->assign('imageID', $imageID); } else { $imageObject = new ImageObject(); $imageData = $imageObject->populate($imageID, Zend_Registry::get("currentEditLanguage")); $this->view->assign('deleted', false); $galleryImageSelect = new GalleriesImages(); $select = $galleryImageSelect->select()->where('GI_ImageID = ?', $imageID); $galleryImageData = $galleryImageSelect->fetchRow($select); $imageData['GI_Online'] = $galleryImageData['GI_Online']; $imageData['GI_Position'] = $galleryImageData['GI_Position']; $cancelUrl = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"; $form = new FormImage(array('baseDir' => $baseDir, 'cancelUrl' => "", 'galleryID' => '', 'imageID' => $imageID)); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $formData['ImageSrc'] = $imageData['ImageSrc']; $imageObject = new ImageObject(); $imageObject->save($imageID, $formData, Zend_Registry::get("currentEditLanguage")); $galleryImageData['GI_Online'] = $form->getValue('GI_Online'); $galleryImageData['GI_Position'] = $form->getValue('GI_Position'); $galleryImageData->save(); $gallerySelect = new Galleries(); $select = $gallerySelect->select()->where('G_ID = ?', $galleryImageData['GI_GalleryID']); $galleryData = $gallerySelect->fetchRow($select); if ($blockID > 0) { $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $categoryID = $blockParameters[0]['P_Value']; $indexData['pageID'] = $categoryID; $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $galleryImageData['GI_GalleryID']; $indexData['languageID'] = Zend_Registry::get("currentEditLanguage"); $indexData['title'] = $formData['II_Title']; $indexData['text'] = ''; $indexData['link'] = 'image'; $indexData['contents'] = $formData['II_Title'] . " " . $formData['II_Description']; if ($formData['GI_Online'] == 1 && $galleryData['G_Online'] == 1) { $indexData['action'] = 'update'; } else { $indexData['action'] = 'delete'; } Cible_FunctionsIndexation::indexation($indexData); } if (!$this->_isXmlHttpRequest) { $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"); } else { $buttonAction = $formData['buttonAction']; $this->view->assign('buttonAction', $buttonAction); $this->view->assign('success', true); $this->view->assign('imageID', $imageID); $this->view->assign('imageTitle', $form->getValue('II_Title')); $this->view->assign('imageDescription', $form->getValue('II_Description')); } } else { $this->view->form = $form; } } else { $form->populate($imageData); $this->view->form = $form; } } //} }