classes/schedConf/SchedConfAction.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 // $Id$
00017 
00018 
00019 class SchedConfAction {
00020 
00024    function SchedConfAction() {
00025    }
00026 
00034    function allowRegReader($schedConf) {
00035       return true;
00036    }
00037 
00041    function allowRegReviewer($schedConf) {
00042       $allowRegReviewer = false;
00043       if($schedConf->getSetting('regReviewerOpenDate') && time() > $schedConf->getSetting('regReviewerOpenDate')) {
00044          $allowRegReviewer = true;
00045       }
00046       if($schedConf->getSetting('regReviewerCloseDate') && time() > $schedConf->getSetting('regReviewerCloseDate')) {
00047          $allowRegReviewer = false;
00048       }
00049       return $allowRegReviewer;
00050    }
00051 
00055    function allowRegAuthor($schedConf) {
00056       $allowRegAuthor = false;
00057       if($schedConf->getSetting('regAuthorOpenDate') && time() > $schedConf->getSetting('regAuthorOpenDate')) {
00058          $allowRegAuthor = true;
00059       }
00060       if($schedConf->getSetting('regAuthorCloseDate') && time() > $schedConf->getSetting('regAuthorCloseDate')) {
00061          $allowRegAuthor = false;
00062       }
00063       return $allowRegAuthor;
00064    }
00065 
00071    function mayViewSchedConf(&$schedConf) {
00072       $conference =& $schedConf->getConference();
00073       return $conference->getEnabled() || Validation::isSiteAdmin() || Validation::isConferenceManager($conference->getId()) || Validation::isDirector($conference->getId(), $schedConf->getId()) || Validation::isTrackDirector($conference->getId(), $schedConf->getId());
00074    }
00075 
00081    function mayViewProceedings(&$schedConf) {
00082       if(Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector() || Validation::isTrackDirector()) {
00083          return true;
00084       }
00085 
00086       if(!SchedConfAction::mayViewSchedConf($schedConf)) {
00087          return false;
00088       }
00089 
00090       if(($schedConf->getSetting('postAbstracts') && time() > $schedConf->getSetting('postAbstractsDate')) ||
00091             ($schedConf->getSetting('postPapers')) && time() > $schedConf->getSetting('postPapersDate')) {
00092 
00093          // Abstracts become publicly available as soon as anything is released.
00094          // Is this too strong an assumption? Presumably, posting abstracts is an
00095          // unabashedly good thing (since it drums up interest in the conference.)
00096          return true;
00097       }
00098 
00099       return false;
00100    }
00101 
00108    function mayViewPapers(&$schedConf, &$conference) {
00109       if(Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector() || Validation::isTrackDirector()) {
00110          return true;
00111       }
00112 
00113       if(!SchedConfAction::mayViewSchedConf($schedConf)) {
00114          return false;
00115       }
00116 
00117       // Allow open access once the "open access" date has passed.
00118       $paperAccess = $conference->getSetting('paperAccess');
00119       if ($paperAccess == PAPER_ACCESS_OPEN) return true;
00120 
00121       if($schedConf->getSetting('delayOpenAccess') && time() > $schedConf->getSetting('delayOpenAccessDate')) {
00122          if(Validation::isReader() && $paperAccess == PAPER_ACCESS_ACCOUNT_REQUIRED) {
00123             return true;
00124          }
00125       }
00126 
00127       if($schedConf->getSetting('postPapers') && time() > $schedConf->getSetting('postPapersDate')) {
00128          if(SchedConfAction::registeredUser($schedConf)) {
00129             return true;
00130          }
00131          if(SchedConfAction::registeredDomain($schedConf)) {
00132             return true;
00133          }
00134       }
00135 
00136       return false;
00137    }
00138 
00143    function entitledUser(&$schedConf) {
00144       $user =& Request::getUser();
00145 
00146       if (isset($user) && isset($schedConf)) {
00147          // If the user is a conference manager, director, or track director,
00148          // it is assumed that they are allowed to view the scheduled conference as a registrant.
00149          $roleDao =& DAORegistry::getDAO('RoleDAO');
00150          $registrationAssumedRoles = array(
00151             ROLE_ID_CONFERENCE_MANAGER,
00152             ROLE_ID_DIRECTOR,
00153             ROLE_ID_TRACK_DIRECTOR
00154          );
00155 
00156          // First check for scheduled conference roles
00157          $roles =& $roleDao->getRolesByUserId($user->getId(), $schedConf->getConferenceId(), $schedConf->getId());
00158          foreach ($roles as $role) {
00159             if (in_array($role->getRoleId(), $registrationAssumedRoles)) return true;
00160          }
00161 
00162          // Second, conference-level roles
00163          $roles =& $roleDao->getRolesByUserId($user->getId(), $schedConf->getConferenceId(), 0);
00164          foreach ($roles as $role) {
00165             if (in_array($role->getRoleId(), $registrationAssumedRoles)) return true;
00166          }
00167       }
00168 
00169       $result = false;
00170       HookRegistry::call('SchedConfAction::entitledUser', array(&$schedConf, &$result));
00171       return $result;
00172    }
00173 
00178    function registeredUser(&$schedConf) {
00179       $user =& Request::getUser();
00180       $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
00181       $result = false;
00182 
00183       if (isset($user) && isset($schedConf)) {
00184 
00185          if(SchedConfAction::entitledUser($schedConf)) return true;
00186 
00187          $result = $registrationDao->isValidRegistration(null, null, $user->getId(), $schedConf->getId());
00188       }
00189       HookRegistry::call('SchedConfAction::registeredUser', array(&$schedConf, &$result));
00190       return $result;
00191    }
00192 
00197    function registeredDomain(&$schedConf) {
00198       $schedConf =& Request::getSchedConf();
00199    
00200       $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
00201       $result = $registrationDao->isValidRegistration(Request::getRemoteDomain(), Request::getRemoteAddr(), null, $schedConf->getId());
00202       HookRegistry::call('SchedConfAction::registeredDomain', array(&$schedConf, &$result));
00203       return $result;
00204    }
00205 
00210    function submissionsOpen(&$schedConf) {
00211       $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
00212       $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
00213 
00214       $currentTime = time();
00215 
00216       return (
00217          $submissionsOpenDate && $submissionsCloseDate &&
00218          $currentTime >= $submissionsOpenDate &&
00219          $currentTime < $submissionsCloseDate
00220       );
00221    }
00222 }
00223 
00224 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7