/** * 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 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; } } }
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); }