Ejemplo n.º 1
0
 /**
  * Handles loading and generating a cms controlled page
  *
  * @return void
  */
 public function viewPageAction()
 {
     $cmsPage = new Datasource_Cms_Pages();
     $page = $cmsPage->getByUrl($this->url);
     // Try to work out whether some sub-styling (landlords, tenants, letting-agents) needs to be applied
     $urlSplit = explode('/', $this->url);
     $pageStyling = 'corporate';
     switch ($urlSplit[0]) {
         case 'landlords':
             $pageStyling = 'landlords';
             break;
         case 'tenants':
             $pageStyling = 'tenants';
             break;
         case 'letting-agents':
             $pageStyling = 'letting-agents';
             break;
     }
     if (count($page) > 0) {
         // Valid page in the database so load it's template and pass in the meta and content data
         $content = $this->view->partial('templates/' . $page['template'] . '.phtml', array('meta' => $page['meta'], 'content' => $page['content'], 'pageStyling' => $pageStyling));
         // Replace code snippets in the content
         $snippets = new Application_Cms_PageSnippets();
         $content = $snippets->replace($content);
         $this->view->content = $content;
         $this->view->pageTitle = $page['title'];
         $this->view->description = $page['description'];
         $this->view->keywords = $page['keywords'];
     } else {
         // Throw a 404 error
         throw new Zend_Controller_Action_Exception("This page doesn't exist", 404);
     }
 }
 public function indexAction()
 {
     // Force response to identify itself as XML, not sure it belongs in a controller
     $this->getResponse()->setHeader('Content-type', 'application/xml');
     $this->_helper->layout->disableLayout();
     $navigation = new Zend_Navigation();
     /* This is going to be hugely dirty. If this still exists in a few months you have my sincere apologies
        I only have a day to write this sitemap and I fully intend to come back and neaten it up at some point */
     // Home
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'Home';
     $page->uri = '/home';
     $page->changefreq = 'daily';
     $navigation->addPage($page);
     // Careers
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'Careers';
     $page->uri = '/careers';
     $page->changefreq = 'daily';
     $navigation->addPage($page);
     // News
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'News';
     $page->uri = '/news';
     $page->changefreq = 'weekly';
     $navigation->addPage($page);
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'Tenants News';
     $page->uri = '/tenants/news';
     $page->changefreq = 'weekly';
     $navigation->addPage($page);
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'Landlords News';
     $page->uri = '/landlords/news';
     $page->changefreq = 'weekly';
     $navigation->addPage($page);
     $page = new Zend_Navigation_Page_Uri();
     $page->label = 'Agents News';
     $page->uri = '/letting-agents/news';
     $page->changefreq = 'weekly';
     $navigation->addPage($page);
     $pageModel = new Datasource_Cms_Pages();
     $cmsPages = $pageModel->getPageList();
     foreach ($cmsPages as $cmsPage) {
         if (!in_array($cmsPage['url'], $this->_suppressCmsUrl)) {
             $page = new Zend_Navigation_Page_Uri();
             $page->label = $cmsPage['title'];
             $page->uri = '/' . $cmsPage['url'];
             $page->changefreq = 'hourly';
             $navigation->addPage($page);
         }
     }
     $this->view->navigation($navigation);
 }
Ejemplo n.º 3
0
 /**
  * Delete an existing site page
  *
  * @return void
  */
 public function deleteAction()
 {
     $pageID = $this->getRequest()->getParam('id');
     $this->view->currentPage = 'pages';
     $pageDatasource = new Datasource_Cms_Pages();
     $page = $pageDatasource->getByID($pageID);
     $pageDatasource->remove($pageID);
     // Record activity
     $auth = Zend_Auth::getInstance();
     $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin'));
     $username = $auth->getStorage()->read()->username;
     Application_Core_ActivityLogger::log('CMS Page Deleted', 'complete', 'CMS-Admin', $username, "Page URL: /" . $page['url']);
     // Changes saved - so send them back with a nice success message
     $this->_helper->getHelper('FlashMessenger')->addMessage(array('deleted' => true));
     $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/pages');
 }