예제 #1
0
 function CatalogDeleteTagAction()
 {
     $request = Project::getRequest();
     $catalog_id = (int) $request->getKeyByNumber(0);
     $page_number = (int) $request->getKeyByNumber(1);
     $tag_page_number = (int) $request->getKeyByNumber(2);
     $tag_id = (int) $request->getKeyByNumber(3);
     $tag_model = new BlogTagModel();
     $tag_model->delete($tag_id);
     Project::getResponse()->redirect($request->createUrl('BlogAdmin', 'CatalogEdit', array($catalog_id, $page_number, $tag_page_number)));
 }
예제 #2
0
 public function CommentsAction()
 {
     $request = Project::getRequest();
     $request_user_id = (int) Project::getUser()->getShowedUser()->id;
     $user_id = (int) Project::getUser()->getDbUser()->id;
     $this->BaseSiteData();
     $info = array();
     $this->BaseBlogData($info);
     $post_id = (int) $request->getKeyByNumber(0);
     $post_page_number = (int) $request->getKeyByNumber(1);
     $page_number = (int) $request->getKeyByNumber(2);
     $post_model = new BlogPostModel();
     $post = $post_model->getPost($post_id, $user_id, $request_user_id);
     if (!$post) {
         $request->clear();
         $this->_view->addFlashMessage(FM::ERROR, "Полный текст этого поста доступен только после подписки на блог.");
         $this->PostListAction();
         return;
     }
     $post_model->load($post_id);
     $this->_view->assign('current_tree_name', $post_model->getTreeNameById($post_model->ub_tree_id));
     $this->_view->assign('post_id', $post_model->id);
     $info['full_text'] = $request_user_id !== $user_id ? $this->PostPreprocess($post_model->full_text, $user_id, $post_model->ub_tree_id) : $post_model->full_text;
     $info['post_title'] = $post_model->title;
     $info['post_creation_date'] = $post_model->creation_date;
     $info['post_allow_comments'] = (int) $post_model->allowcomments;
     $tree_model = new BlogTreeModel();
     $tree_model->load($post_model->ub_tree_id);
     $blog_banners_model = new BlogModel('blog_banners');
     $blog_banners_model->load($tree_model->blog_banner_id);
     $info['blog_banner_code'] = $blog_banners_model->code;
     $controller = new BaseCommentController();
     $info['comment_list'] = $controller->CommentList($post_id, $page_number, $this->getParam('comment_per_page'), 'Blog', 'Comments', 'blog', array($post_id, $post_page_number), (int) $post_model->allowcomments);
     $tag_model = new BlogTagModel();
     $tag_model->load($post_model->bc_tag_id);
     $info['post_tag'] = $tag_model->name;
     //$moodModel = new MoodModel();
     //$moodModel->load($post_model->mood);
     $info['post_mood'] = $post_model->mood;
     //$moodModel -> name;
     $userModel = new UserModel();
     $info['user_avatar'] = $userModel->getFullAvatarById($post_model->avatar_id);
     $info['add_comment_url'] = $request->createUrl('Blog', 'SaveComment', array($post_id, $post_page_number, $page_number));
     $this->_view->assign('post_user_id', $request_user_id);
     $this->_view->CommentList($info);
     $this->_view->parse();
 }