/** * View the discussion * */ 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 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 = $this->request->get('page'); if ($page < 1) { $page = 1; } // if $this->smarty->assign(array('page_back_url' => assemble_url('mobile_access_view_discussions', array('project_id' => $this->active_project->getId())), 'page' => $page)); $this->addBreadcrumb(str_excerpt(clean($this->active_discussion->getName()), 10), mobile_access_module_get_view_url($this->active_discussion)); $this->addBreadcrumb(lang('View')); }
/** * 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 }