/**
  * Save changes to an existing panel. This can be expanded to allow adding of new Panels in the future.
  *
  * @return void
  */
 protected function _savePanel()
 {
     // First of all we need to validate and sanitise the input from the form
     $urlFilter = new Zend_Filter();
     $urlFilter->addFilter(new Zend_Filter_StringTrim());
     $urlFilter->addFilter(new Zend_Filter_StringTrim('/'));
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     $filters = array('id' => 'Digits');
     $validators = array('id' => array('allowEmpty' => true), 'content' => array('allowEmpty' => true));
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     if ($input->isValid()) {
         // Data is all valid, formatted and sanitized so we can save it in the database
         $panel = new Datasource_Cms_Panels();
         if (!$input->id) {
             // This is a new panel so we need to create a new ID
             // NOT IMPLEMENTED - YET
         } else {
             $panel->saveChanges($input->id, $input->getUnescaped('content'));
             $panelID = $input->id;
         }
         // Changes saved - so send them back with a nice success message
         $this->_helper->getHelper('FlashMessenger')->addMessage(array('saved' => true));
         $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/panels/edit?id=' . $panelID);
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
 public function helppopupAction()
 {
     // Fetch content from CMS using key
     $contentKey = $this->getRequest()->getParam('key');
     $panelObj = new Datasource_Cms_Panels();
     $contentArray = $panelObj->getByKey($contentKey);
     $this->view->content = $contentArray['content'];
     // Disable the layout
     $this->_helper->layout->disableLayout();
 }
Пример #3
0
 public function promoContent($key)
 {
     // Get promo panel content
     $panelObj = new Datasource_Cms_Panels();
     $panelContent = $panelObj->getByKey($key);
     if (!is_null($panelContent)) {
         return $panelContent['content'];
     } else {
         return '';
     }
 }
Пример #4
0
 public function fetch($panelKey)
 {
     // Check for content panel to go into panel and pass into view
     $panelShow = false;
     $panelContent = '';
     $panelObj = new Datasource_Cms_Panels();
     $panel = $panelObj->getByKey($panelKey);
     if (!is_null($panel)) {
         $panelContent = $panel['content'];
         if (!is_null($panelContent) && trim($panelContent) != '') {
             $panelShow = true;
         }
     }
     $this->getActionController()->view->panelShow = $panelShow;
     $this->getActionController()->view->panelContent = $panelContent;
 }