/** * View specific discussion * * @param void * @return null */ function view() { if ($this->active_discussion->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_discussion->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->active_discussion->getIsPinned()) { $this->wireframe->addPageMessage(lang('<strong>Pinned</strong> - This discussion is pinned'), 'pinned'); } // if if ($this->request->isApiCall()) { $this->serveData($this->active_discussion, 'discussion', array('describe_comments' => true)); } else { ProjectObjectViews::log($this->active_discussion, $this->logged_user); $parent = $this->active_discussion->getParent(); if (instance_of($parent, 'Category')) { $this->active_category = $parent; $this->smarty->assign('active_category', $parent); } // if $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if list($comments, $pagination) = $this->active_discussion->paginateComments($page, $this->active_discussion->comments_per_page, $this->logged_user->getVisibility()); $this->smarty->assign(array('category' => $this->active_discussion->getParent(), 'comments' => $comments, 'pagination' => $pagination, 'counter' => ($page - 1) * $this->active_discussion->comments_per_page, 'subscribers' => $this->active_discussion->getSubscribers(), 'object_id' => $this->active_discussion->getId())); } // if }