Exemple #1
0
 function actionIndex($params = '')
 {
     $objPage = new PagesModel();
     $objLayout = new LayoutModel();
     $page_id = !empty($params['page_id']) ? intval($params['page_id']) : 0;
     $previewPage = !empty($params['preview']) ? true : false;
     if (empty($params['page_id'])) {
         $page_id = $objPage->getPageId('home');
     }
     $pageInfo = $objPage->loadPage($page_id);
     if (!empty($pageInfo) && $pageInfo['status'] == 'published' && $pageInfo['type'] == 'page' || $previewPage == true) {
         // load additional page info
         $sideBars = $objPage->getPageSidebars($page_id);
         $layoutInfo = $objLayout->loadLayout($pageInfo['layout_id']);
         // used to set active state in menu
         $this->view->current_page = $pageInfo['keyName'];
         //assign template vars
         $this->view->assign('pageTitle', $pageInfo['title']);
         $this->view->assign('content', $this->view->fetch('fromstring:' . $pageInfo['content']));
         if (!empty($sideBars)) {
             $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $sideBars['left']['content']));
             $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $sideBars['right']['content']));
         }
         $this->view->assign('layout', $this->view->fetch('fromstring:' . $layoutInfo['code']));
     } else {
         // page not found
         $this->view->assign('layout', '404 - ' . print_r($params, true));
     }
     $this->finish();
 }
Exemple #2
0
 function actionEditpage($params = '')
 {
     $objPage = new PagesModel();
     $objLayouts = new LayoutModel();
     $page_id = !empty($params['page_id']) ? intval($params['page_id']) : false;
     if (!empty($params['dosave'])) {
         $page_id = $this->savePage($params);
         if (!empty($params['ajaxsave'])) {
             $pageInfo = $objPage->loadPage($page_id);
             echo json_encode($pageInfo);
             return;
         }
         $this->messages[] = array('type' => 'success', 'message' => 'Page has been saved.');
         if ($params['submit'] == 'Save and Close') {
             $this->actionPages();
             return;
         }
     }
     $pageList = $objPage->getPages();
     $this->view->assign('pageList', $pageList);
     $layouts = $objLayouts->getLayouts();
     $this->view->assign('layouts', $layouts);
     if (!empty($page_id)) {
         $pageInfo = $objPage->loadPage($page_id);
         $pageInfo['sidebars'] = $objPage->getPageSidebars($pageInfo['id']);
         $this->view->assign('pageInfo', $pageInfo);
     }
     if (!empty($params['type']) && $params['type'] == 'link') {
         $tpl = 'tpl/content/link.tpl';
     } else {
         $tpl = 'tpl/content/page.tpl';
     }
     $this->view->assign('content', $this->view->fetch($tpl));
     $this->view->assign('messages', $this->messages);
     $this->finish();
 }