function actionLayouts($params = '') { $objLayouts = new LayoutModel(); $layoutList = $objLayouts->getLayouts(); $this->view->assign('layoutList', $layoutList); $this->view->assign('content', $this->view->fetch('tpl/design/layouts.tpl')); $this->view->assign('messages', $this->messages); $this->finish(); }
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(); }
function actionEditArticle($params = '') { $objBlog = new BlogModel(); $article_id = !empty($params['article_id']) ? intval($params['article_id']) : false; if (!empty($params['dosave'])) { $saveData = array(); $saveData['id'] = !empty($params['article_id']) ? intval($params['article_id']) : false; $saveData['title'] = !empty($params['article_title']) ? $params['article_title'] : 'Unnamed'; $saveData['keyName'] = !empty($params['article_keyName']) ? $params['article_keyName'] : ''; $saveData['article'] = !empty($params['article_article']) ? $params['article_article'] : ''; $saveData['author_id'] = !empty($params['article_author_id']) ? intval($params['article_author_id']) : false; $saveData['category_id'] = !empty($params['article_category_id']) ? intval($params['article_category_id']) : ''; $saveData['publishDate'] = !empty($params['article_publishDate']) ? date("Y-m-d H:i:s", strtotime($params['article_publishDate'])) : date("Y-m-d H:i:s"); $saveData['allow_comments'] = !empty($params['article_allow_comments']) ? intval($params['article_allow_comments']) : false; $saveData['layout_id'] = !empty($params['article_layout_id']) ? intval($params['article_layout_id']) : false; $saveData['status'] = !empty($params['article_status']) ? $params['article_status'] : 'draft'; $saveData['url'] = !empty($params['article_url']) ? $params['article_url'] : false; $saveData['meta']['title'] = !empty($params['meta_title']) ? $params['meta_title'] : ''; $saveData['meta']['description'] = !empty($params['meta_description']) ? $params['meta_description'] : ''; $saveData['meta']['keywords'] = !empty($params['meta_keywords']) ? $params['meta_keywords'] : ''; $article_id = $objBlog->saveArticle($saveData); if (!empty($params['ajaxsave'])) { $articleInfo = $objBlog->loadArticle($article_id); echo json_encode($articleInfo); return; } $this->messages[] = array('type' => 'success', 'message' => 'Blog article has been saved.'); if ($params['submit'] == 'Save and Close') { $this->actionArticles(); return; } } $categoryList = $objBlog->getCategories(); $this->view->assign('categoryList', $categoryList); $objUsers = new UserModel(); $this->view->assign('userList', $objUsers->getUsers('admin')); $objLayouts = new LayoutModel(); $layouts = $objLayouts->getLayouts(); $this->view->assign('layouts', $layouts); if (!empty($article_id)) { $articleInfo = $objBlog->loadArticle($article_id); } else { $articleInfo['layout_id'] = $objBlog->getDefaultArticleLayout(); } $this->view->assign('articleInfo', $articleInfo); $this->view->assign('content', $this->view->fetch('tpl/blog/article.tpl')); $this->view->assign('messages', $this->messages); $this->finish(); }