/** * @descrpition 修改 */ public function edit() { if (Request::getRequest('dosubmit', 'str')) { $jumpUrl = '/admin.php/itemdocmenu/edit/id-' . $this->param['id']; $fields = array(); $fields['name'] = Request::getRequest('name', 'str'); $fields['pid'] = Request::getRequest('pid', 'str'); $fields['in_out'] = Request::getRequest('in_out', 'str'); $fields['url'] = Request::getRequest('url', 'str'); $fields['item'] = strtolower(Request::getRequest('item', 'item')); if (empty($fields['name']) || empty($fields['item'])) { View::showAdminErrorMessage($jumpUrl, '未填写完成'); } $result = ItemDocMenuBusiness::editMenu($this->param['id'], $fields); if ($result) { View::showAdminMessage('/admin.php/itemdocmenu/lists', '修改成功'); } else { View::showAdminErrorMessage($jumpUrl, '修改失败'); } } $menuList = ItemDocMenuBusiness::getMenuList(); $menuList = Func::arrayKey($menuList); $blogMenuList = Func::categoryTree($menuList); $blogMenu = ItemDocMenuBusiness::getMenu($this->param['id']); View::assign('blogMenu', $blogMenu); View::assign('blogMenuList', $blogMenuList); View::showAdminTpl('item_doc_menu_edit'); }
/** * * 构造函数 * @param $param 实例化时传入的参数 */ public function __construct($param = array()) { $this->param = $param; //分类菜单相关 $this->adminMenuObi = new AdminMenuModel(); $this->menuList = $this->adminMenuObi->getList(); $this->menuList = Func::arrayKey($this->menuList); $this->menuListTree = Func::categoryTree($this->menuList); View::assign('menuList', $this->menuListTree); }
/** * 手册首页 */ public function main() { $articleId = isset($this->param['aid']) ? $this->param['aid'] : 0; if (!$articleId) { $article = ItemDocArticleBusiness::getOneMostOld(); } else { //获取文章信息 $article = ItemDocArticleBusiness::getArticle($articleId); } if (empty($article)) { View::showErrorMessage(ITEM_DOMAIN, '内容丢掉了-.-'); } $articleId = $article['id']; $article['ctime'] = date('Y-m-d H:i:s', $article['ctime']); $article['tag'] = empty($article['tag']) ? '' : explode('|', $article['tag']); //获取该文章的评论 $commentList = ItemDocCommentBusiness::getCommentByAid($articleId); $commentList = Func::arrayKey($commentList); //将评论二级分类 foreach ($commentList as $key => $comment) { if ($comment['cid'] != 0) { $commentList[$comment['cid']]['son'][] = $comment; unset($commentList[$key]); } } //对文章进行处理,代码部分特殊显示. $article['content'] = preg_replace('/\\[code\\]/s', '<pre class="prettyprint linenums">', $article['content']); $article['content'] = preg_replace('/\\[\\/code\\]/s', '</pre>', $article['content']); //SEO的title,keywords,description $seo_title = $article['seo_title']; $seo_description = $article['seo_description']; $seo_keywords = $article['seo_keywords']; //文章的点击数+1 ItemDocArticleBusiness::clicks($articleId); //获取项目下的菜单列表 $itemMenuList = ItemDocMenuBusiness::getMenuListByItem(); $itemMenuList = Func::arrayKey($itemMenuList); //获取项目下的文章列表 $itemArticleList = ItemDocArticleBusiness::getListByItem(); foreach ($itemArticleList as $itemArticle) { if (isset($itemMenuList[$itemArticle['mid']])) { $itemMenuList[$itemArticle['mid']]['article_list'][] = $itemArticle; } } View::assign('itemMenuList', $itemMenuList); View::assign('seo_title', $seo_title); View::assign('seo_description', $seo_description); View::assign('seo_keywords', $seo_keywords); View::assign('commentList', $commentList); View::assign('article', $article); View::showFrontTpl('doc'); }
/** * * 构造函数 * @param $param 实例化时传入的参数 */ public function __construct($param = array()) { $this->param = $param; //分类菜单相关 $this->menuList = MenuBusiness::getMenuList(); $this->menuList = Func::arrayKey($this->menuList); $actionMenuId = 0; if (isset($param['mid']) && isset($this->menuList[$param['mid']])) { $actionMenuId = $param['mid']; } View::assign('actionMenuId', $actionMenuId); View::assign('menuList', $this->menuList); }
/** * 获取评论列表 */ public function lists_comment() { $page = isset($this->param['page']) && $this->param['page'] > 0 ? $this->param['page'] : 1; $commentList = ItemDocCommentBusiness::getCommentListPage($page); $pageNav = $commentList['page_nav']; $commentList = $commentList['data']; $articleIdList = ""; foreach ($commentList as $comment) { $articleIdList .= "`id` = '" . $comment['id'] . "' OR "; } $articleIdList = substr($articleIdList, 0, -4); $articleList = ItemDocArticleBusiness::getListByWhere($articleIdList); $articleList = Func::arrayKey($articleList); foreach ($commentList as &$comment) { if (isset($articleList[$comment['aid']])) { $comment['article_name'] = $articleList[$comment['aid']]['title']; } } View::assign('commentList', $commentList); View::assign('pageNav', $pageNav); View::showAdminTpl('article_comment_list'); }
/** * @descrpition 单篇文章展示 * @return Ambigous */ public function main() { $articleId = $this->param['aid']; if (empty($articleId)) { View::showErrorMessage(GAME_URL, '参数错误'); } //获取文章信息 $article = ArticleBusiness::getArticle($articleId); if (empty($article)) { View::showErrorMessage(GAME_URL, '内容丢掉了-.-'); } $article['author'] = $article['author']; $article['title'] = $article['title']; $article['description'] = $article['description']; $article['ctime'] = date('Y-m-d H:i:s', $article['ctime']); $article['tag'] = explode('|', $article['tag']); // $article['content'] = htmlspecialchars_decode($article['content']); // preg_match_all("/\[code\](.*?)\[\/code\]/s", $article['content'], $match); // // $article['content'] = preg_replace("/\[code\](.*?)\[\/code\]/s", htmlspecialchars('${1}'), $article['content']); //获取该文章的评论 $commentList = CommentBusiness::getCommentByAid($this->param['aid']); $commentList = Func::arrayKey($commentList); //将评论二级分类 foreach ($commentList as $key => $comment) { if ($comment['cid'] != 0) { $commentList[$comment['cid']]['son'][] = $comment; unset($commentList[$key]); } } //获取该分类下热门文章 $articleHotList = ArticleBusiness::getHotListByMid($article['mid']); foreach ($articleHotList as $k => $a) { $articleHotList[$k]['title'] = mb_substr($a['title'], 0, 30, 'UTF-8') . '...'; } //获取该分类下最新评论 $commentNewList = CommentBusiness::getNewListByMid($article['mid']); foreach ($commentNewList as $key => $comment) { $commentNewList[$key]['content'] = mb_substr($commentNewList[$key]['content'], 0, 30, 'UTF-8') . '...'; } //获取Tag $tags = TagBusiness::getRandList(ParamConstant::PARAM_TAG_LIST_NUM); //对文章进行处理,代码部分特殊显示. $article['content'] = preg_replace('/\\[code\\]/s', '<pre class="prettyprint linenums">', $article['content']); $article['content'] = preg_replace('/\\[\\/code\\]/s', '</pre>', $article['content']); //SEO的title,keywords,description $seo_title = $article['seo_title']; $seo_description = $article['seo_description']; $seo_keywords = $article['seo_keywords']; //文章的点击数+1 ArticleBusiness::clicks($articleId); View::assign('seo_title', $seo_title); View::assign('seo_description', $seo_description); View::assign('seo_keywords', $seo_keywords); View::assign('tags', $tags); View::assign('commentList', $commentList); View::assign('commentNewList', $commentNewList); View::assign('articleHotList', $articleHotList); View::assign('article', $article); View::showFrontTpl('article'); }
/** * @descrpition 修改 */ public function edit() { if (Request::getRequest('dosubmit', 'str')) { $jumpUrl = '/admin.php/menu/edit/id-' . $this->param['id']; $fields = array(); $fields['name'] = Request::getRequest('name', 'str'); $fields['pid'] = Request::getRequest('pid', 'str'); $fields['in_out'] = Request::getRequest('in_out', 'str'); $fields['seo_title'] = Request::getRequest('seo_title', 'str'); $fields['seo_description'] = Request::getRequest('seo_description', 'str'); $fields['seo_keywords'] = Request::getRequest('seo_keywords', 'str'); $fields['url'] = Request::getRequest('url', 'str'); $fields['item'] = Request::getRequest('url', 'item'); if (empty($fields['name'])) { View::showAdminErrorMessage($jumpUrl, '未填写完成'); } $result = MenuBusiness::editMenu($this->param['id'], $fields); if ($result) { View::showAdminMessage('/admin.php/menu/lists', '添加成功'); } else { View::showAdminErrorMessage($jumpUrl, '添加失败'); } } $menuList = MenuBusiness::getMenuList(); $menuList = Func::arrayKey($menuList); $blogMenuList = Func::categoryTree($menuList); $blogMenu = MenuBusiness::getMenu($this->param['id']); View::assign('blogMenu', $blogMenu); View::assign('blogMenuList', $blogMenuList); View::showAdminTpl('menu_edit'); }