/** * View specific page * * @param void * @return null */ function view() { //BOF:mod 20120814 $redirect_to_page_id = ''; switch ($this->active_page->getId()) { case '22836': $redirect_to_page_id = '26019'; break; case '21394': $redirect_to_page_id = '26136'; break; case '21400': $redirect_to_page_id = '26137'; break; case '21401': $redirect_to_page_id = '26138'; break; case '24845': $redirect_to_page_id = '26139'; break; case '24859': $redirect_to_page_id = '26140'; break; case '24867': $redirect_to_page_id = '26141'; break; case '25498': $redirect_to_page_id = '26142'; break; } if (!empty($redirect_to_page_id)) { $this->redirectToUrl(assemble_url('project_page', array('project_id' => TASK_LIST_PROJECT_ID, 'page_id' => $redirect_to_page_id))); } //EOF:mod 20120814 if ($this->active_page->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall()); } // if if (!$this->active_page->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall()); } // if if ($this->request->isApiCall()) { $this->serveData($this->active_page, 'page', array('describe_comments' => true, 'describe_tasks' => true, 'describe_attachments' => true, 'describe_subpages' => true, 'describe_revisions' => true)); } else { ProjectObjectViews::log($this->active_page, $this->logged_user); $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if $show_all = $this->request->get('show_all'); if (!empty($show_all) && $show_all == '1' && !isset($_GET['comment_id'])) { $comments = null; $pagination = null; } else { $show_all = ''; list($comments, $pagination) = $this->active_page->paginateComments($page, $this->active_page->comments_per_page, $this->logged_user->getVisibility()); } $comments_only_mode = $this->request->get('comments_only_mode'); if ($comments_only_mode) { $this->smarty->assign(array('_object_comments_comments' => $comments, 'pagination' => $pagination, '_counter' => ($page - 1) * $this->active_page->comments_per_page)); echo $this->smarty->fetch(get_template_path('_object_comments_ajax', 'comments', RESOURCES_MODULE)); exit; } $scroll_to_comment = $this->request->get('comment_id'); /*if (!empty($scroll_to_comment)){ for($i=0; $i<count($comments); $i++){ if ($comments[$i]->getId()==$scroll_to_comment){ $scroll_to_comment = ''; break; } } }*/ $dID = $_GET['dID']; if (!empty($dID)) { $this->active_page->changeDepartmentTo($dID); } $pID = $_GET['pID']; if (!empty($pID)) { $this->active_page->setMilestoneId($pID); $this->active_page->save(); $this->active_page->changeDepartmentTo(ProjectObject::getDepartmentId($pID)); } $this->smarty->assign(array('parent' => $this->active_page->getParent(), 'subpages' => $this->active_page->getSubpages($this->logged_user->getVisibility()), 'versions' => $this->active_page->getVersions(), 'comments' => $comments, 'pagination' => $pagination, 'subscribers' => $this->active_page->getSubscribers(), 'current_user_id' => $this->logged_user->getId(), 'object_id' => $this->active_page->getId(), 'scroll_to_comment' => $scroll_to_comment, 'show_all' => $show_all)); } // if }