/**
  * Imposta i valori di default del menu.
  * Va a interrogare il database, ricercando quali sono le pagine figlie della root.
  */
 protected function setDefault()
 {
     $Menu = Zwe_Model_Page::getMenu();
     foreach ($Menu as $M) {
         $this->_default[] = array('Url' => $M['Url'], 'Title' => $M['Title']);
     }
 }
Beispiel #2
0
 /**
  * Ritorna l'oggetto che identifica la pagina che si sta navigando ora.
  * Se l'oggetto non è ancora stato creato lo inizializza.
  *
  * @static
  * @param string $Url
  * @return Zwe_Model_Page
  */
 public static function getThisPage($Url = null)
 {
     if (isset($Url) && !isset(self::$_thisPage)) {
         self::$_thisPage = self::getPageByURL($Url);
     }
     return self::$_thisPage;
 }
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     try {
         Zwe_Model_Page::getThisPage($request->getRequestUri());
     } catch (Exception $E) {
         # Do nothing
     }
 }
Beispiel #4
0
 public function orderAction()
 {
     $this->_helper->layout->disableLayout();
     if ($this->getRequest()->isPost()) {
         $Data = $this->getRequest()->getPost();
         if ($Data['order']) {
             Zwe_Model_Page::orderPages(Zend_Json::decode(stripslashes($Data['order'])));
             $this->view->message = "Page order was changed successfully";
         }
     }
 }
 /**
  * Inizializzazione del controller.
  * Si occupa di memorizzare la pagina e il titolo.
  */
 public function init()
 {
     $this->view->thePage = Zwe_Model_Page::getThisPage();
     $this->view->title = $this->view->thePage->Title;
     if (!$this->view->title) {
         $this->view->title = $this->_title;
     }
     if ($this->view->title) {
         $this->view->headTitle()->append($this->view->title);
     }
 }
Beispiel #6
0
 public function __set($Name, $Value)
 {
     if ('News' == $Name) {
         if (is_array($Value)) {
             $this->_news = $Value;
         } else {
             throw new Exception('$Value must be an array');
         }
     } else {
         parent::__set($Name, $Value);
     }
 }
Beispiel #7
0
 public function init()
 {
     function FromTypeToOption($Type)
     {
         return array('key' => $Type['IDType'], 'value' => $Type['Type']);
     }
     $this->setName('form_page');
     $this->setMethod('post');
     $this->addElement('text', 'title', array('required' => true, 'label' => 'Title:', 'filters' => array('StringTrim')));
     $this->addElement('select', 'parent', array('required' => true, 'label' => 'Parent:'));
     $Options = $this->getView()->getPageSelect(Zwe_Model_Page::getTree());
     $this->getElement('parent')->addMultiOption('0', 'Root');
     $this->getElement('parent')->addMultiOptions($Options);
     $this->addElement('text', 'url', array('required' => true, 'label' => 'Url:', 'filters' => array('StringTrim')));
     $this->getElement('url')->addValidator(new Zwe_Validate_Url());
     $this->addElement('select', 'type', array('required' => true, 'label' => 'Type:'));
     $Types = Zwe_Model_PageType::getTypes();
     $this->getElement('type')->addMultiOptions(array_map("FromTypeToOption", $Types));
     $this->addElement('textarea', 'text', array('required' => false, 'label' => 'Text:', 'filters' => array('StringTrim')));
     $this->getElement('text')->setAttrib('id', 'page_text');
     $this->addElement('submit', 'page', array('label' => 'Create the page'));
 }
Beispiel #8
0
 /**
  * Ritorna se una pagina è associata o meno a questo routing.
  *
  * @param string $path L'uri della pagina
  * @return array|bool I parametri della pagina o, nel caso non sia una pagina news, false
  */
 public function match($path)
 {
     $this->_page = Zwe_Model_Page::getThisPage($path);
     return $this->isMatching() ? $this->_defaults + $this->getParameters() : false;
 }
 public function init()
 {
     parent::init();
     $this->view->ThePage = Zwe_Model_Page::getPageByURL($this->_getParam('page'));
 }
Beispiel #10
0
 /**
  * Il costruttore dell'oggetto.
  * Richiama il metodo padre e per compatibilità assegna il titolo alla pagina
  *
  * @param array $config L'array di configurazione, passato sempre per compatibilità
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->Title = 'Login';
 }