/**
  * Show single milestone
  *
  * @param void
  * @return null
  */
 function view()
 {
     $show_archived_pages = '0';
     $show_completed_tkts = '0';
     if ($this->active_milestone->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_milestone->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     ProjectObjectViews::log($this->active_milestone, $this->logged_user);
     if ($this->request->isApiCall()) {
         $this->serveData($this->active_milestone, 'milestone', array('describe_assignees' => true));
     } else {
         $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_milestone->paginateComments($page, $this->active_milestone->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_milestone->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;
         				}
         			}
         		}*/
         if (isset($_GET['archived_pages'])) {
             $show_archived_pages = $_GET['archived_pages'];
         }
         if (isset($_GET['completed_tkts'])) {
             $show_completed_tkts = $_GET['completed_tkts'];
         }
         $total_objects = 0;
         $objects = $this->active_milestone->getObjects($this->logged_user);
         if (is_foreachable($objects)) {
             foreach ($objects as $objects_by_module) {
                 $total_objects += count($objects_by_module);
             }
             // foreach
         }
         // if
         // ---------------------------------------------------
         //  Prepare add suboject links
         // ---------------------------------------------------
         $links_code = '';
         $links = array();
         event_trigger('on_milestone_add_links', array($this->active_milestone, $this->logged_user, &$links));
         if (is_foreachable($links)) {
             $total_links = count($links);
             $counter = 1;
             foreach ($links as $k => $v) {
                 $links_code .= open_html_tag('a', array('href' => $v)) . $k . '</a>';
                 if ($counter < $total_links - 1) {
                     $links_code .= ', ';
                 } elseif ($counter == $total_links - 1) {
                     $links_code .= ' ' . lang('or') . ' ';
                 }
                 // if
                 $counter++;
             }
             // foreach
         }
         // if
         $dID = $_GET['dID'];
         if (!empty($dID)) {
             $this->active_milestone->changeDepartmentTo($dID, array('Page'));
         }
         $this->smarty->assign(array('total_objects' => $total_objects, 'milestone_objects' => $objects, 'milestone_add_links_code' => $links_code, 'subscribers' => $this->active_milestone->getSubscribers(), 'current_user_id' => $this->logged_user->getId(), 'show_archived_pages' => $show_archived_pages, 'show_completed_tkts' => $show_completed_tkts, 'object_id' => $this->active_milestone->getId(), 'comments' => $comments, 'pagination' => $pagination, 'counter' => ($page - 1) * $this->active_milestone->comments_per_page, 'scroll_to_comment' => $scroll_to_comment, 'show_all' => $show_all));
     }
     // if
 }