Esempio n. 1
0
 /**
  * View Article.
  */
 function view($args)
 {
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $journalRt = $rtDao->getJournalRTByJournal($journal);
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getArticleId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $article->getArticleId());
     }
     if (!$journalRt->getEnabled()) {
         if (!$galley || $galley->isHtmlGalley()) {
             return ArticleHandler::viewArticle($args);
         } else {
             if ($galley->isPdfGalley()) {
                 return ArticleHandler::viewPDFInterstitial($args, $galley);
             } else {
                 if ($galley->isInlineable()) {
                     import('file.ArticleFileManager');
                     $articleFileManager =& new ArticleFileManager($article->getArticleId());
                     return $articleFileManager->viewFile($galley->getFileId());
                 } else {
                     return ArticleHandler::viewDownloadInterstitial($args, $galley);
                 }
             }
         }
     }
     if (!$article) {
         Request::redirect(null, Request::getRequestedPage());
         return;
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('articleId', $articleId);
     $templateMgr->assign_by_ref('article', $article);
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->display('article/view.tpl');
 }