public function formscontactAction() { $blockParamEmail = Cible_FunctionsBlocks::getBlockParameter($this->_getParam('BlockID'), '1'); if (isset($blockParamEmail)) { $mailTo = $blockParamEmail; } $form = new FormContact(); $this->view->assign('form', $form); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if (array_key_exists('submit', $formData)) { if ($form->isValid($formData)) { // send the mail $data = array('firstName' => $formData['prenom'], 'lastName' => $formData['name'], 'email' => $formData['email'], 'comments' => $formData['commentaire'], 'language' => 1); $options = array('send' => true, 'isHtml' => true, 'moduleId' => $this->_moduleID, 'event' => 'contact', 'type' => 'email', 'recipient' => 'admin', 'data' => $data); if (!empty($mailTo)) { $options['to'] = $mailTo; } $oNotification = new Cible_Notifications_Email($options); $this->view->assign('inscriptionValidate', true); } } } else { } }
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(); } }
/** * Overwrite the function define in the SiteMapInterface implement in Cible_Controller_Action * * This function return the sitemap specific for this module * * @access public * * @return a string containing xml sitemap */ public function homepagelistAction() { $_blockID = $this->_request->getParam('BlockID'); $languageID = Zend_Registry::get('languageID'); $link = Cible_FunctionsBlocks::getBlockParameter($_blockID, $languageID); $linkMax = Cible_FunctionsBlocks::getBlockParameter($_blockID, 3); $block_info = Cible_FunctionsBlocks::getBlockDetails($_blockID); $db = Zend_Registry::get("db"); $feed = Zend_Feed_Reader::import($link); $data = array('block_title' => $block_info["BI_BlockTitle"], 'linkMax' => $linkMax, 'title' => $feed->getTitle(), 'link' => $feed->getLink(), 'dateModified' => $feed->getDateModified(), 'description' => $feed->getDescription(), 'language' => $feed->getLanguage(), 'entries' => array()); foreach ($feed as $entry) { $edata = array('title' => $entry->getTitle(), 'description' => $entry->getDescription(), 'dateModified' => $entry->getDateModified(), 'authors' => $entry->getAuthors(), 'link' => $entry->getLink(), 'content' => $entry->getContent()); $data['entries'][] = $edata; } $this->view->data = $data; }
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; } } //} }
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); } }
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); }
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); }
public function editAction() { // web page title $this->view->title = "Edition de formulaire"; // Tests if the user has permissions if ($this->view->aclIsAllowed($this->_name, 'manage', true)) { // set variables needed for the process $formID = $this->_getParam('formID'); $returnAction = $this->_getParam('return'); $pageID = $this->_getParam('pageID'); $blockID = $this->_getParam('blockID'); $baseDir = $this->view->baseUrl(); if (empty($formID) && !empty($blockID)) { $formID = Cible_FunctionsBlocks::getBlockParameter($blockID, '1'); } // Define the url where to return if ($returnAction) { $returnUrl = "/form/index/{$returnAction}"; } elseif ($pageID) { $returnUrl = "/page/index/index/ID/{$pageID}"; } else { $returnUrl = "/form/index/list/"; } //Add specific js file $this->view->headScript()->appendFile($this->view->locateFile('headerFormActions.js')); $this->view->headScript()->appendFile($this->view->locateFile('tiny_mce/tiny_mce.js')); $oNotifications = new FormNotificationObject(); $recipients = $oNotifications->getAll(null, true, $formID); // Get data for the current form $oForm = new FormObject(); $data = $oForm->populate($formID, $this->getCurrentEditLanguage()); //Generate the form for the back button $formBack = new FormBackButton(array('baseDir' => $baseDir, 'cancelUrl' => "{$baseDir}{$returnUrl}", 'disableAction' => false)); $formBack->removeElement('submitSave'); $formBack->getElement('cancel')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'li')), array(array('row' => 'HtmlTag'), array('tag' => 'ul', 'openOnly' => true, 'class' => 'actions-buttons'))))->setOrder(1); $this->view->formBack = $formBack; //Generate the form $form = new FormForm(array('baseDir' => $baseDir, 'cancelUrl' => "{$baseDir}{$returnUrl}", 'formID' => $formID, 'disableAction' => true, 'recipients' => $recipients)); $this->view->form = $form; //Add question type data $oQuestion = new FormQuestionTypeObject(); $questionData = $oQuestion->getAll($this->getCurrentEditLanguage()); $this->view->questionType = $questionData; // action: If not post action (send modification) if (!$this->_request->isPost()) { //Populate the for with data from db $form->populate($data); } else { // Get data sent $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $languages = Cible_FunctionsGeneral::getAllLanguage(); var_dump($languages); exit; // and save value in db $oForm->save($formID, $formData, $this->getCurrentEditLanguage()); $oForm->save($formID, $formData, $this->getCurrentEditLanguage()); $this->_redirect($returnUrl); } } } }
public function editInfoAction() { // web page title $this->view->title = "Modification d'une infolettre"; if ($this->view->aclIsAllowed('newsletter', 'manage', true)) { // variables $pageID = $this->_getParam('pageID'); $blockID = $this->_getParam('blockID'); $newsletterID = $this->_getParam('newsletterID'); $baseDir = $this->view->baseUrl(); $newsletterSelect = new NewsletterReleases(); $select = $newsletterSelect->select(); $select->where('NR_ID = ?', $newsletterID); $newsletterData = $newsletterSelect->fetchRow($select); // generate the form $cancelUrl = "/newsletter/index/edit/blockID/{$blockID}/pageID/{$pageID}/newsletterID/{$newsletterID}"; $form = new FormNewsletter(array('baseDir' => $baseDir, 'cancelUrl' => $baseDir . $cancelUrl)); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $newsletterData['NR_LanguageID'] = $form->getValue('NR_LanguageID'); $newsletterData['NR_CategoryID'] = $form->getValue('NR_CategoryID'); $newsletterData['NR_ModelID'] = $form->getValue('NR_ModelID'); $newsletterData['NR_Title'] = $form->getValue('NR_Title'); $newsletterData['NR_AdminEmail'] = $form->getValue('NR_AdminEmail'); $newsletterData['NR_ValUrl'] = Cible_FunctionsGeneral::formatValueForUrl($form->getValue('NR_Title')); $newsletterData['NR_Date'] = $form->getValue('NR_Date'); $newsletterData['NR_TextIntro'] = $form->getValue('NR_TextIntro'); $newsletterData['NR_Online'] = $formData['NR_Online'] == 0 ? 2 : 1; $newsletterData['NR_AfficherTitre'] = $form->getValue('NR_AfficherTitre'); $newsletterData->save(); $blockData = Cible_FunctionsBlocks::getBlockDetails($blockID); $status = $blockData['B_Online']; if ($newsletterData['NR_Online'] == 1 && $status == 1 || $newsletterData['NR_Online'] == 0) { // get all article in the release $articlesSelect = new NewsletterArticles(); $select = $articlesSelect->select()->where('NA_ReleaseID = ?', $newsletterID); $articlesData = $articlesSelect->fetchAll($select); $indexData['pageID'] = $pageID; $indexData['moduleID'] = 8; $indexData['languageID'] = $newsletterData['NR_LanguageID']; foreach ($articlesData as $article) { $indexData['contentID'] = $article['NA_ID']; if ($newsletterData['NR_Online'] == 1) { $indexData['title'] = $article['NA_Title']; $indexData['text'] = Cible_FunctionsGeneral::stripTextWords(Cible_FunctionsGeneral::html2text($article['NA_Resume'])); $indexData['link'] = ''; $indexData['contents'] = Cible_FunctionsGeneral::html2text($article['NA_Resume'] . "<br/>" . $article['NA_Text']); $indexData['action'] = 'update'; } elseif ($newsletterData['NR_Online'] == 0) { $indexData['action'] = 'delete'; } Cible_FunctionsIndexation::indexation($indexData); } } } $this->_redirect($cancelUrl); } else { $data = $newsletterData->toArray(); if ($data['NR_Online'] == 2) { $data['NR_Online'] = 0; } $form->populate($data); $this->view->form = $form; } } }
/** * 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; } }
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); }
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(); }
protected function updatePosition($blockID, $n) { $block = Cible_FunctionsBlocks::getBlockDetails($blockID); $pageID = $block['B_PageID']; $oldPosition = $block['B_Position']; $newPosition = $oldPosition + $n; $zoneID = $block['B_ZoneID']; $db = Zend_Registry::get("db"); $where = "B_Position = '{$newPosition}' AND B_ZoneID = '{$zoneID}' AND B_PageID = '{$pageID}'"; $db->update('Blocks', array('B_Position' => $oldPosition), $where); $where = "B_ID = " . $blockID; $db->update('Blocks', array('B_Position' => $newPosition), $where); }
public function setBlockID($value) { $this->_blockID = $value; $_params = Cible_FunctionsBlocks::getBlockParameters($value); foreach ($_params as $param) { $this->_blockParams[$param['P_Number']] = $param['P_Value']; } }
public function newsfeedAction() { $this->view->assign('lang', Zend_Registry::get('languageSuffix')); $categoryID = Cible_FunctionsBlocks::getBlockParameter($this->_getParam('BlockID'), 1); $this->view->assign('CategoryID', $categoryID); }
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(); }
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; } } //} }