Beispiel #1
0
 /**
  * Paper view
  * @param $args array
  * @param $request Request
  */
 function viewPaper($args, &$request)
 {
     $router =& $request->getRouter();
     $paperId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? (int) $args[1] : 0;
     $this->validate($request, $paperId, $galleyId);
     $conference =& $router->getContext($request, CONTEXT_CONFERENCE);
     $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF);
     $paper =& $this->paper;
     $this->setupTemplate($request);
     $rtDao = DAORegistry::getDAO('RTDAO');
     $conferenceRt = $rtDao->getConferenceRTByConference($conference);
     $trackDao = DAORegistry::getDAO('TrackDAO');
     $track =& $trackDao->getTrack($paper->getTrackId());
     if ($conferenceRt->getVersion() != null && $conferenceRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($conferenceRt->getVersion(), $conferenceRt->getConferenceId());
         if ($version) {
             foreach ($version->getContexts() as $context) {
                 if ($context->getDefineTerms()) {
                     $defineTermsContextId = $context->getContextId();
                     break;
                 }
             }
         }
     }
     $commentDao = DAORegistry::getDAO('CommentDAO');
     $enableComments = $conference->getSetting('enableComments');
     $commentsRequireRegistration = $conference->getSetting('commentsRequireRegistration');
     $commentsAllowAnonymous = $conference->getSetting('commentsAllowAnonymous');
     if ($enableComments && $paper->getEnableComments()) {
         $comments =& $commentDao->getRootCommentsBySubmissionId($paper->getId());
     }
     $paperGalleyDao = DAORegistry::getDAO('PaperGalleyDAO');
     $galley =& $paperGalleyDao->getGalley($galleyId, $paper->getId());
     $templateMgr =& TemplateManager::getManager($request);
     if (!$galley) {
         // Get the registration status if displaying the abstract;
         // if access is open, we can display links to the full text.
         import('classes.schedConf.SchedConfAction');
         $templateMgr->assign('mayViewPaper', SchedConfAction::mayViewPapers($schedConf, $conference));
         $templateMgr->assign('registeredUser', SchedConfAction::registeredUser($schedConf));
         $templateMgr->assign('registeredDomain', SchedConfAction::registeredDomain($schedConf));
         // Increment the published paper's abstract views count
         $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO');
         $publishedPaperDao->incrementViewsByPaperId($paper->getId());
     } else {
         // Increment the galley's views count
         $paperGalleyDao->incrementViews($galleyId);
         // Use the paper's CSS file, if set.
         if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
             $templateMgr->addStyleSheet($router->url($request, null, null, 'paper', 'viewFile', array($paper->getId(), $galley->getId(), $styleFile->getFileId())));
         }
     }
     // Add font sizer js and css if not already in header
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     if (strpos(strtolower_codesafe($additionalHeadData), 'sizer.js') === false) {
         $additionalHeadData .= $templateMgr->fetch('common/sizer.tpl');
         $templateMgr->assign('additionalHeadData', $additionalHeadData);
     }
     $templateMgr->assign_by_ref('schedConf', $schedConf);
     $templateMgr->assign_by_ref('conference', $conference);
     $templateMgr->assign_by_ref('paper', $paper);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->assign_by_ref('track', $track);
     $templateMgr->assign('paperId', $paperId);
     $closeCommentsDate = $schedConf->getSetting('closeCommentsDate');
     $commentsClosed = $schedConf->getSetting('closeComments') ? true : false && strtotime($closeCommentsDate < time());
     $templateMgr->assign('closeCommentsDate', $closeCommentsDate);
     $templateMgr->assign('commentsClosed', $commentsClosed);
     $templateMgr->assign('postingAllowed', $enableComments && !$commentsClosed && $paper->getEnableComments() && (!$commentsRequireRegistration || Validation::isLoggedIn()));
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
     $templateMgr->assign('comments', isset($comments) ? $comments : null);
     if ($paper->getRoomId()) {
         $roomDao = DAORegistry::getDAO('RoomDAO');
         $buildingDao = DAORegistry::getDAO('BuildingDAO');
         $room =& $roomDao->getRoom($paper->getRoomId());
         if (!$room) {
             break;
         }
         $building =& $buildingDao->getBuilding($room->getBuildingId());
         $templateMgr->assign_by_ref('room', $room);
         $templateMgr->assign_by_ref('building', $building);
     }
     $templateMgr->display('paper/paper.tpl');
 }
Beispiel #2
0
 /**
  * Checks if a user has access to view papers
  * @param $schedConf object
  * @param $conference object
  * @return bool
  */
 function mayViewPapers(&$schedConf, &$conference)
 {
     if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector() || Validation::isTrackDirector()) {
         return true;
     }
     if (!SchedConfAction::mayViewSchedConf($schedConf)) {
         return false;
     }
     // Allow open access once the "open access" date has passed.
     $paperAccess = $conference->getSetting('paperAccess');
     if ($paperAccess == PAPER_ACCESS_OPEN) {
         return true;
     }
     if ($schedConf->getSetting('delayOpenAccess') && time() > $schedConf->getSetting('delayOpenAccessDate')) {
         if (Validation::isReader() && $paperAccess == PAPER_ACCESS_ACCOUNT_REQUIRED) {
             return true;
         }
     }
     if ($schedConf->getSetting('postPapers') && time() > $schedConf->getSetting('postPapersDate')) {
         if (SchedConfAction::registeredUser($schedConf)) {
             return true;
         }
         if (SchedConfAction::registeredDomain($schedConf)) {
             return true;
         }
     }
     return false;
 }