function smarty_function_menu($params, &$smarty) { $output = ''; $objPages = new PagesModel(); $pageList = $objPages->getPages('published'); global $__pageListTemp; if (!empty($pageList)) { // limit to a parent if (!empty($params['parent'])) { // find parent $parent_id = $objPages->getPageId($params['parent']); if ($parent_id) { smarty_function_menu_parent($pageList, $parent_id); $pageList = $__pageListTemp; } } reset($pageList); // limit depth if (!empty($params['depth'])) { $depth = intval($params['depth']); $pageList = smarty_function_menu_setdepth($pageList, $depth); } reset($pageList); // remove specific pages if (!empty($params['remove'])) { $params['remove'] .= ',404'; } else { $params['remove'] = '404'; } $pageList = smarty_function_menu_removepages($pageList, $params['remove']); reset($pageList); // set active classes if (!empty($smarty->current_page)) { $pageList = smarty_function_menu_makeactive($pageList, $smarty->current_page); } reset($pageList); // draw menu $output = smarty_function_menu_makemenu($pageList, $output, $smarty); } return $output; }
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(); }