Beispiel #1
0
 public function __construct($blockID = null)
 {
     $this->_db = Zend_Registry::get('db');
     $this->_current_lang = Zend_Registry::get('languageID');
     if ($blockID) {
         $this->_blockID = $blockID;
         $_params = Cible_FunctionsBlocks::getBlockParameters($blockID);
         foreach ($_params as $param) {
             $this->_blockParams[$param['P_Number']] = $param['P_Value'];
         }
     } else {
         $this->_blockID = null;
         $this->_blockParams = array();
     }
 }
Beispiel #2
0
 public function toExcelAction()
 {
     $this->filename = 'Events.xlsx';
     $tables = array('EventsData' => array('ED_ID', 'ED_CategoryID'), 'EventsIndex' => array('EI_EventsDataID', 'EI_LanguageID', 'EI_Title', 'EI_Status'), 'Status' => array('S_Code'));
     $this->fields = array('EI_Title' => array('width' => '', 'label' => ''), 'S_Code' => array('width' => '', 'label' => ''));
     $this->filters = array();
     $this->view->params = $this->_getAllParams();
     $events = new EventsData();
     $this->select = $this->_db->select()->from('EventsData')->join('EventsIndex', 'EventsData.ED_ID = EventsIndex.EI_EventsDataID')->join('Status', 'EventsIndex.EI_Status = Status.S_ID')->where('EI_LanguageID = ?', $this->_defaultEditLanguage)->order('EI_Title');
     $blockID = $this->_getParam('blockID');
     $pageID = $this->_getParam('pageID');
     if ($blockID && $pageID) {
         $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID);
         $categoryID = $blockParameters[0]['P_Value'];
         $this->select->where('ED_CategoryID = ?', $categoryID);
     }
     parent::toExcelAction();
 }
Beispiel #3
0
 public function editAction()
 {
     $this->view->title = "Modification d'une galerie";
     //if ($this->view->aclIsAllowed('gallery','manage',true)){
     // variables
     $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest);
     $this->view->assign('success', false);
     $pageID = $this->_getParam('pageID');
     $blockID = $this->_getParam('blockID');
     $galleryID = $this->_getParam('galleryID');
     $baseDir = $this->view->baseUrl();
     $galleryObject = new GalleryObject();
     $galleryData = $galleryObject->populate($galleryID, Zend_Registry::get("currentEditLanguage"));
     $imageObject = new ImageObject();
     $imageData = $imageObject->populate($galleryData['G_ImageID'], Zend_Registry::get("currentEditLanguage"));
     if (!$galleryData) {
         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);
         $config = Zend_Registry::get('config')->toArray();
         $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight'];
         $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth'];
         $thumbName = str_replace($imageData['ImageSrc'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $imageData['ImageSrc'], $imageData['ImageSrc']);
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             $isNewImage = $formData['isNewImage'];
             if ($isNewImage == 'true') {
                 $imageSrc = Zend_Registry::get("www_root") . "/data/images/gallery/" . $galleryID . "/tmp/mcith/mcith_" . $formData['ImageSrc'];
             } else {
                 $imageSrc = Zend_Registry::get("www_root") . "/data/images/gallery/{$galleryID}/" . $galleryData['G_ImageID'] . "/" . $thumbName;
             }
         } else {
             //$imageData['ImageSrc_preview'] = Zend_Registry::get("www_root")."/data/images/gallery/$galleryID/".$galleryData['G_ImageID']."/".$thumbName;
             $imageSrc = Zend_Registry::get("www_root") . "/data/images/gallery/{$galleryID}/" . $galleryData['G_ImageID'] . "/" . $thumbName;
             //$this->view->assign('imageUrl', $imageData['ImageSrc_preview']);
             $this->view->assign('imageUrl', $imageSrc);
             $isNewImage = 'false';
             //$imageSrc   = $imageData['ImageSrc_preview'];
         }
         // generate the form
         if ($blockID != '') {
             $cancelUrl = "{$baseDir}/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}";
         } elseif ($this->_categoryID != '') {
             $cancelUrl = "{$baseDir}/gallery/index/list/catID/{$this->_categoryID}";
         } else {
             $cancelUrl = "{$baseDir}/gallery/index/list/";
         }
         $form = new FormGallery(array('baseDir' => $baseDir, 'cancelUrl' => '', 'galleryID' => $galleryID, 'imageSrc' => $imageSrc, 'isNewImage' => $isNewImage, 'requiredTitle' => true, 'requiredPosition' => false, 'requiredDescription' => false));
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $galleryObject = new GalleryObject();
                 $formattedName = Cible_FunctionsGeneral::formatValueForUrl($formData['GI_Title']);
                 $formData['GI_ValUrl'] = $formattedName;
                 if ($blockID != '') {
                     $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID);
                     $formData['G_CategoryID'] = $blockParameters[0]['P_Value'];
                 } elseif ($this->_categoryID != '') {
                     $formData['G_CategoryID'] = $this->_categoryID;
                 }
                 if ($formData['isNewImage'] == 'true') {
                     // create the image
                     $imageObject = new ImageObject();
                     $formData['II_Title'] = $formData['GI_Title'];
                     $formData['II_Description'] = $formData['GI_Description'];
                     $imageID = $imageObject->insert($formData, Zend_Registry::get("currentEditLanguage"));
                     // update the galery
                     $formData['G_CreationDate'] = $galleryData['G_CreationDate'];
                     $formData['G_ImageID'] = $imageID;
                     $galleryObject->save($galleryID, $formData, Zend_Registry::get("currentEditLanguage"));
                     $config = Zend_Registry::get('config')->toArray();
                     $srcOriginal = "../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/tmp/" . $form->getValue('ImageSrc');
                     $originalMaxHeight = $config['gallery']['image']['original']['maxHeight'];
                     $originalMaxWidth = $config['gallery']['image']['original']['maxWidth'];
                     $originalName = str_replace($form->getValue('ImageSrc'), $originalMaxWidth . 'x' . $originalMaxHeight . '_' . $form->getValue('ImageSrc'), $form->getValue('ImageSrc'));
                     $srcThumb = "../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/tmp/mcith/mcith_" . $form->getValue('ImageSrc');
                     $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight'];
                     $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth'];
                     $thumbName = str_replace($form->getValue('ImageSrc'), $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $form->getValue('ImageSrc'), $form->getValue('ImageSrc'));
                     Cible_FunctionsImageResampler::resampled(array('src' => $srcOriginal, 'maxWidth' => $originalMaxWidth, 'maxHeight' => $originalMaxHeight));
                     Cible_FunctionsImageResampler::resampled(array('src' => $srcThumb, 'maxWidth' => $thumbMaxWidth, 'maxHeight' => $thumbMaxHeight));
                     // Attempts to create the directory specified by pathname.
                     mkdir("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/" . $imageID) or die("Could not make directory");
                     // Rename and move the original image to the specific place
                     rename("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/tmp/" . $form->getValue('ImageSrc'), "../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/" . $imageID . "/" . $originalName);
                     // Rename and move the thumbnail image to the specific place
                     rename("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/tmp/mcith/mcith_" . $form->getValue('ImageSrc'), "../../{$this->_config->document_root}/data/images/gallery/" . $galleryID . "/" . $imageID . "/" . $thumbName);
                 } else {
                     $formData['G_CreationDate'] = $galleryData['G_CreationDate'];
                     $formData['G_ImageID'] = $galleryData['G_ImageID'];
                     $galleryObject->save($galleryID, $formData, Zend_Registry::get("currentEditLanguage"));
                 }
                 if ($blockID != '') {
                     $indexData['pageID'] = $blockParameters[0]['P_Value'];
                     $indexData['moduleID'] = $this->_moduleID;
                     $indexData['contentID'] = $galleryID;
                     $indexData['languageID'] = Zend_Registry::get("currentEditLanguage");
                     $indexData['title'] = $formData['GI_Title'];
                     $indexData['text'] = '';
                     $indexData['link'] = 'gallery';
                     $indexData['contents'] = $formData['GI_Title'] . " " . $formData['GI_Description'];
                     if ($formData['G_Online'] == 1) {
                         $indexData['action'] = 'update';
                     } else {
                         $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 = ?', Zend_Registry::get("currentEditLanguage"));
                 $imageData = $imageSelect->fetchAll($select)->toArray();
                 $cpt = count($imageData);
                 for ($i = 0; $i < $cpt; $i++) {
                     $indexData['pageID'] = $galleryID;
                     $indexData['moduleID'] = $this->_moduleID;
                     $indexData['contentID'] = $imageData[$i]['II_ImageID'];
                     $indexData['languageID'] = $imageData[$i]['II_LanguageID'];
                     $indexData['title'] = $imageData[$i]['II_Title'];
                     $indexData['text'] = '';
                     $indexData['link'] = 'image';
                     $indexData['contents'] = $imageData[$i]['II_Title'] . " " . $imageData[$i]['II_Description'];
                     if ($formData['G_Online'] == 1) {
                         $indexData['action'] = 'update';
                         if ($imageData[$i]['GI_Online'] == 1) {
                             Cible_FunctionsIndexation::indexation($indexData);
                         }
                     } else {
                         $indexData['action'] = 'delete';
                         Cible_FunctionsIndexation::indexation($indexData);
                     }
                 }
                 if (!$this->_isXmlHttpRequest) {
                     if ($blockID != '') {
                         $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}");
                     } else {
                         $this->_redirect("/gallery/index/list/catID/{$this->_categoryID}");
                     }
                 } else {
                     $buttonAction = $formData['buttonAction'];
                     $this->view->assign('buttonAction', $buttonAction);
                     $this->view->assign('success', true);
                     $this->view->assign('galleryID', $galleryID);
                     $this->view->assign('galleryTitle', $form->getValue('GI_Title'));
                     $this->view->assign('galleryDescription', $form->getValue('GI_Description'));
                     $this->view->assign('galleryLanguage', Zend_Registry::get("currentEditLanguage"));
                 }
             } else {
                 $this->view->form = $form;
             }
         } else {
             $form->populate($galleryData);
             $form->populate($imageData);
             $this->view->form = $form;
         }
     }
     //}
 }
Beispiel #4
0
 public function listarchivesAction()
 {
     // Newsletter ID and Category ID
     $categoryID = $this->_getParam('categoryID');
     $newsletterID = $this->_getParam('newsletterID');
     $back_to_newsletter = !empty($newsletterID) ? "/ID/{$newsletterID}" : '';
     // Get the Newsletter ID to dont show
     $newsletterSelect = new NewsletterReleases();
     $select = $newsletterSelect->select()->setIntegrityCheck(false);
     $select->from('Newsletter_Releases')->join('Languages', 'L_ID = NR_LanguageID', array())->join('CategoriesIndex', 'CI_CategoryID = NR_CategoryID', array())->join('Newsletter_Models_Index', 'NMI_NewsletterModelID = NR_ModelID', array())->join('Newsletter_Models', 'NM_ID = NMI_NewsletterModelID', array())->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->where('NR_LanguageID = ?', Zend_Registry::get("languageID"))->where('NR_Online = ?', 1)->order('NR_Date DESC');
     $newsletterData = $newsletterSelect->fetchRow($select);
     $actualNewsletterOnline = $newsletterData['NR_ID'];
     if ($actualNewsletterOnline != '') {
         if (empty($categoryID) || $categoryID == '') {
             $categoryID = $newsletterData['NR_CategoryID'];
         }
         //get all releases exept the one online
         $releasesSelect = new NewsletterReleases();
         $select = $releasesSelect->select()->setIntegrityCheck(false);
         $select->from('Newsletter_Releases')->join('CategoriesIndex', 'CI_CategoryID = NR_CategoryID')->join('Status', 'Newsletter_Releases.NR_Online = Status.S_ID')->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->where('NR_LanguageID = ?', Zend_Registry::get("languageID"))->where('NR_Online = ?', 1)->where('NR_CategoryID = ?', $categoryID)->where('NR_ID <> ?', $actualNewsletterOnline)->order('NR_Date DESC');
         $releasesData = $releasesSelect->fetchAll($select);
         $this->view->assign('listArchives', $releasesData);
         $this->view->assign('subscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'subscribe', 8));
         $this->view->assign('unsubscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'unsubscribe', 8));
         //$this->view->assign('detailsRelease', $this->view->baseUrl()."/".Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details_release', 8));
         $this->view->assign('detailsRelease', Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details_release', 8));
         //$this->view->assign('back_to_release', Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details_release', 8));
         $this->view->assign('back_to_release', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details_release', 8) . $back_to_newsletter);
         $this->view->assign('archivesLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'list_archives', 8) . '/categoryID/' . $categoryID);
     } else {
         $this->view->assign('listArchives', array());
         $blockID = $this->_getParam('BlockID');
         $blockParams = Cible_FunctionsBlocks::getBlockParameters($blockID)->toArray();
         $newsletterCategoryID = $blockParams[0]['P_Value'];
         $this->view->assign('subscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'subscribe', 8));
         $this->view->assign('unsubscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'unsubscribe', 8));
         $this->view->assign('back_to_release', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8) . $back_to_newsletter);
         $this->view->assign('archivesLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'list_archives', 8) . '/categoryID/' . $newsletterCategoryID);
     }
 }
Beispiel #5
0
 public function listpromosAction()
 {
     $blockID = $this->_request->getParam('BlockID');
     if ($blockID) {
         $this->_blockID = $blockID;
         $params = Cible_FunctionsBlocks::getBlockParameters($blockID);
     }
     foreach ($params as $param) {
         $blockParams[$param['P_Number']] = $param['P_Value'];
     }
     $this->view->assign('autoPlay', $blockParams[2]);
     $this->view->assign('delais', $blockParams[3]);
     $this->view->assign('transition', $blockParams[4]);
     $this->view->assign('navi', $blockParams[5]);
     $this->view->assign('effect', $blockParams[6]);
     if ($blockParams[7]) {
         $category = Cible_FunctionsCategories::getCategoryDetails($blockParams[7]);
         $this->view->assign('promoLbl', $category['CI_Title']);
     } else {
         $this->view->assign('promoLbl', $this->view->getClientText('catalog_promo_default_label_render'));
     }
     $oPromo = new PromosObject();
     $promos = $oPromo->getPromosByCategory($blockParams[7]);
     $this->view->assign('promos', $promos);
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 public function listAction()
 {
     if ($this->view->aclIsAllowed('newsletter', 'manage', true)) {
         $tables = array('Newsletter_Releases' => array('NR_ID', 'NR_Title', 'NR_Date', 'NR_Online', 'NR_Status'), 'Status' => array('S_Code'));
         $field_list = array('NR_Title' => array(), 'NR_Date' => array('width' => '120px'), 'S_Code' => array('width' => '80px', 'postProcess' => array('type' => 'dictionnary', 'prefix' => 'status_')), 'NR_Status' => array('width' => '80px', 'postProcess' => array('type' => 'dictionnary', 'prefix' => 'send_')));
         $this->view->params = $this->_getAllParams();
         $blockID = $this->_getParam('blockID');
         $pageID = $this->_getParam('pageID');
         $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID);
         $categoryID = $blockParameters[0]['P_Value'];
         $category = new CategoriesIndex();
         $select = $category->select()->where('CI_CategoryID = ?', $categoryID)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"));
         $categoryArray = $category->fetchRow($select);
         $this->view->assign('categoryName', $categoryArray['CI_Title']);
         //get all releases
         $releasesSelect = new NewsletterReleases();
         $select = $releasesSelect->select()->setIntegrityCheck(false);
         $select->from('Newsletter_Releases')->join('CategoriesIndex', 'CI_CategoryID = NR_CategoryID')->join('Status', 'Newsletter_Releases.NR_Online = Status.S_ID')->where('CI_LanguageID = ?', Zend_Registry::get("languageID"));
         //->order('NR_Title');
         $releasesData = $releasesSelect->fetchAll($select);
         $options = array('commands' => array($this->view->link($this->view->url(array('controller' => 'index', 'action' => 'add')), $this->view->getCibleText('button_add_newsletter'), array('class' => 'action_submit add'))), 'disable-export-to-excel' => 'true', 'filters' => array('newsletter-category-filter' => array('label' => 'Filtre 1', 'default_value' => null, 'associatedTo' => 'S_Code', 'choices' => array('' => $this->view->getCibleText('filter_empty_status'), 'online' => $this->view->getCibleText('status_online'), 'offline' => $this->view->getCibleText('status_offline'))), 'newsletter-status-filter' => array('label' => 'Filtre 2', 'default_value' => null, 'associatedTo' => 'NR_Status', 'choices' => array('' => $this->view->getCibleText('filter_empty_send'), 1 => $this->view->getCibleText('send_1'), 0 => $this->view->getCibleText('send_2')))), 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('button_edit'), 'url' => "{$this->view->baseUrl()}/newsletter/index/edit/newsletterID/%ID%/pageID/" . $pageID . "/blockID/" . $blockID, 'findReplace' => array('search' => '%ID%', 'replace' => 'NR_ID')), 'delete' => array('label' => $this->view->getCibleText('button_delete'), 'url' => "{$this->view->baseUrl()}/newsletter/index/delete/newsletterID/%ID%/pageID/" . $pageID . "/blockID/" . $blockID, 'findReplace' => array('search' => '%ID%', 'replace' => 'NR_ID')))));
         $mylist = new Cible_Paginator($select, $tables, $field_list, $options);
         $this->view->assign('mylist', $mylist);
     }
 }
Beispiel #8
0
 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;
         }
     }
     //}
 }
Beispiel #9
0
 public function formAction()
 {
     $formId = 0;
     $_blockID = $this->_request->getParam('BlockID');
     $_params = Cible_FunctionsBlocks::getBlockParameters($_blockID);
     $_recipient = (int) $_params[0]['P_Value'];
     $params['id'] = $_recipient;
     $params['langId'] = $this->getCurrentEditLanguage();
     $oForm = new FormObject($params);
     $data = $oForm->getFormData();
     $this->_formTitle = $data['form']['FI_Title'];
     $form = new FormFront(null, $data);
     $hasCaptcha = $form->getHasCaptcha();
     $isValidCaptcha = true;
     //Get form parameters and test if need to be logged to submit
     //@todo: Create the process in second phase.
     $hasProfileLogged = false;
     $lastPage = false;
     $sendNotification = $form->getSendNotification();
     // If the user submit the form
     if ($this->_request->isPost()) {
         // get submitted data
         $formData = $this->_request->getPost();
         // The form is valid
         if ($form->isValid($formData)) {
             // Test if he captcha value is ok
             if ($hasCaptcha) {
                 $_captcha = $form->getElement('captcha');
                 $isValidCaptcha = $_captcha->isValid($_POST['captcha'], $_POST);
             }
             // If correct captcha or have no captcha
             if ($hasCaptcha && $isValidCaptcha || !$hasCaptcha) {
                 // Test if the user has to be logged (and have a profile)
                 if ($hasProfileLogged) {
                     //TODO: Create the process to save data
                     // test if it's a multi page form and if it's the last page
                     $lastPage = false;
                     if (!$lastPage) {
                         /* TODO: Load the next form and display it.
                          * Exit this process.
                          */
                     }
                 }
                 /* Send an email to the recipient int the notification list
                  * of the form.
                  */
                 // create a the mail content
                 $_config = Zend_Registry::get('config');
                 $formTest = $form->populate($formData);
                 $emailContent = $this->_emailRender($formTest);
                 $this->view->assign('formMail', $emailContent);
                 $view = $this->getHelper('ViewRenderer')->view;
                 $html = $view->render('index/emailToSend.phtml');
                 if ($sendNotification) {
                     $formId = $params['id'];
                     // Retrieve the recipent list and the sender
                     $oNotification = new FormNotificationObject();
                     $sender = $_config->form->sender;
                     $recipients = $oNotification->getNotificationEmails($formId);
                     // Create the email and send it
                     $mail = new Zend_Mail('utf-8');
                     $mail->setBodyHtml($html)->setFrom($sender, $_config->site->title)->setSubject($this->_formTitle);
                     foreach ($recipients as $recipient) {
                         $mail->addTo($recipient['FN_Email']);
                     }
                     $mail->send();
                     $this->renderScript('index/forms-contact-thank-you.phtml');
                 } else {
                     $this->renderScript('index/form-error-notification.phtml');
                 }
             }
         } else {
             $form->populate($formData);
         }
     }
     $this->view->assign($this->_name, $form);
 }
Beispiel #10
0
 public function allLecteurRssToExcelAction()
 {
     $this->filename = 'LecteurRss.xlsx';
     $tables = array('LecteurRssData' => array('ND_ID', 'ND_CategoryID', 'ND_Date', 'ND_ReleaseDate'), 'LecteurRssIndex' => array('NI_LecteurRssDataID', 'NI_LanguageID', 'NI_Title', 'NI_Status'), 'Status' => array('S_Code'), 'CategoriesIndex' => array('CI_Title'));
     $this->fields = array('NI_Title' => array('width' => '', 'label' => ''), 'ND_ReleaseDate' => array('width' => '', 'label' => ''), 'ND_Date' => array('width' => '', 'label' => ''), 'CI_Title' => array('width' => '', 'label' => ''), 'S_Code' => array('width' => '', 'label' => ''));
     $this->filters = array();
     $this->view->params = $this->_getAllParams();
     $LecteurRss = new LecteurRssData();
     $this->select = $this->_db->select()->from('LecteurRssData')->join('LecteurRssIndex', 'LecteurRssData.ND_ID = LecteurRssIndex.NI_LecteurRssDataID')->join('Status', 'LecteurRssIndex.NI_Status = Status.S_ID')->join('CategoriesIndex', 'LecteurRssData.ND_CategoryID = CategoriesIndex.CI_CategoryID')->where('NI_LanguageID = ?', Zend_Registry::get("languageID"))->order('NI_Title');
     $blockID = $this->_getParam('blockID');
     $pageID = $this->_getParam('pageID');
     if ($blockID && $pageID) {
         $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID);
         $categoryID = $blockParameters[0]['P_Value'];
         $this->select->where('ND_CategoryID = ?', $categoryID);
     }
     parent::toExcelAction();
 }
Beispiel #11
0
 public function saveBlock($formData, $pageID, $blockID)
 {
     $block = Cible_FunctionsBlocks::getBlockDetailsByLangID($blockID, $this->_currentEditLanguage);
     $db = Zend_Registry::get("db");
     $block['BI_BlockTitle'] = $formData['BI_BlockTitle'];
     $block->save();
     $db = Zend_Registry::get("db");
     $where = "B_ID = " . $blockID;
     $db->update('Blocks', array('B_ShowHeader' => $formData['B_ShowHeader'], 'B_Secured' => $formData['B_Secured']), $where);
     // save parameters
     $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID);
     $i = 1;
     foreach ($blockParameters as $parameter) {
         $where = "P_BlockID = " . $blockID . " AND P_Number = " . $parameter["P_Number"];
         $db->update('Parameters', array('P_Value' => $formData["Param{$parameter['P_Number']}"]), $where);
         $i++;
     }
 }
Beispiel #12
0
 public function setBlockID($value)
 {
     $this->_blockID = $value;
     $_params = Cible_FunctionsBlocks::getBlockParameters($value);
     foreach ($_params as $param) {
         $this->_blockParams[$param['P_Number']] = $param['P_Value'];
     }
 }
Beispiel #13
0
 /**
  * Display the list
  *
  *
  *
  * @return void
  */
 public function featuredAction()
 {
     $langId = Zend_Registry::get('languageID');
     $blockID = $this->_request->getParam('BlockID');
     if ($blockID) {
         $this->_blockID = $blockID;
         $params = Cible_FunctionsBlocks::getBlockParameters($blockID);
         $groupId = 0;
         $autoPlay = 0;
         $delais = 0;
         $transition = 0;
         $navi = 0;
         $effect = 0;
         foreach ($params as $param) {
             $blockParams[$param['P_Number']] = $param['P_Value'];
         }
         $videos = new VideoObject();
         $listVideo = array();
         $listVideo = $videos->getVideosList();
         // var_dump($listVideo);
         $groupId = str_replace('_f', '', $blockParams[1]);
         $this->view->autoPlay = $blockParams[2];
         $this->view->delais = $blockParams[3];
         $this->view->transition = $blockParams[4];
         $this->view->navi = $blockParams[5];
         $this->view->effect = $blockParams[6];
         $oBannerFeat = new BannerFeaturedObject();
         $oImageFeat = new BannerFeaturedImageObject();
         $banner = $oBannerFeat->populate($groupId, $langId);
         $imgBanner = $oImageFeat->getData($langId, $groupId);
         //var_dump($imgBanner);
         //exit;
         $config = Zend_Registry::get('config');
         $cfgBanner = $config->banners->imagefeat->toArray();
         $this->view->imgCfg = $cfgBanner;
         $this->view->imgFeat = $imgBanner;
         $this->view->imgPath = $this->_imagesFolder . 'featured/' . $groupId . '/';
         $this->view->videoPath = $this->_rootVideoPath;
         //$this->view->listVideos = $listVideo;
     }
 }