/** * Show file details * * @param void * @return null */ function view() { if ($this->active_file->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_file->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $last_revision = $this->active_file->getLastRevision(); if (!instance_of($last_revision, 'Attachment')) { flash_error('Invalid file - last revision was not found'); $this->redirectToUrl(files_module_url($this->active_project)); } // if ProjectObjectViews::log($this->active_file, $this->logged_user); if ($this->request->isApiCall()) { $this->serveData($this->active_file, 'file', array('describe_revisions' => true)); } else { $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if list($comments, $pagination) = $this->active_file->paginateComments($page, $this->active_file->comments_per_page, $this->logged_user->getVisibility()); $this->smarty->assign(array('revisions' => $this->active_file->getRevisions(), 'last_revision' => $last_revision, 'comments' => $comments, 'pagination' => $pagination, 'counter' => ($page - 1) * $this->active_file->comments_per_page, 'subscribers' => $this->active_file->getSubscribers())); } // if }