コード例 #1
0
ファイル: UserHandler.inc.php プロジェクト: pulipulichen/ocs
 /**
  * Gather information about a user's role within a conference.
  * @param $userId int
  * @param $conferenceId int 
  * @param $submissionsCount array reference
  * @param $isValid array reference
  */
 function getRoleDataForConference($userId, $conferenceId, $schedConfId, &$submissionsCount, &$isValid)
 {
     if (Validation::isConferenceManager($conferenceId)) {
         $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
         $isValid["ConferenceManager"][$conferenceId][$schedConfId] = true;
     }
     if (Validation::isDirector($conferenceId, $schedConfId)) {
         $isValid["Director"][$conferenceId][$schedConfId] = true;
         $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
         $submissionsCount["Director"][$conferenceId][$schedConfId] = $directorSubmissionDao->getDirectorSubmissionsCount($schedConfId);
     }
     if (Validation::isTrackDirector($conferenceId, $schedConfId)) {
         $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
         $submissionsCount["TrackDirector"][$conferenceId][$schedConfId] = $trackDirectorSubmissionDao->getTrackDirectorSubmissionsCount($userId, $schedConfId);
         $isValid["TrackDirector"][$conferenceId][$schedConfId] = true;
     }
     if (Validation::isReviewer($conferenceId, $schedConfId)) {
         $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
         $submissionsCount["Reviewer"][$conferenceId][$schedConfId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $schedConfId);
         $isValid["Reviewer"][$conferenceId][$schedConfId] = true;
     }
     if (Validation::isAuthor($conferenceId, $schedConfId)) {
         $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
         $submissionsCount["Author"][$conferenceId][$schedConfId] = $authorSubmissionDao->getSubmissionsCount($userId, $schedConfId);
         $isValid["Author"][$conferenceId][$schedConfId] = true;
     }
 }
コード例 #2
0
 function checkRole(&$conference, &$schedConf)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
     $templateMgr->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
     $templateMgr->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
     $templateMgr->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
 }
コード例 #3
0
ファイル: AuthorAction.inc.php プロジェクト: sedici/ocs
 function mayEditPaper(&$authorSubmission)
 {
     $schedConf =& Request::getSchedConf();
     if (!$schedConf || $schedConf->getId() != $authorSubmission->getSchedConfId()) {
         unset($schedConf);
         $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
         $schedConf =& $schedConfDao->getSchedConf($paper->getSchedConfId());
     }
     // Directors acting as Authors can always edit.
     if (Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) || Validation::isTrackDirector($schedConf->getConferenceId(), $schedConf->getId())) {
         return true;
     }
     // Incomplete submissions can always be edited.
     if ($authorSubmission->getSubmissionProgress() != 0) {
         return true;
     }
     // Archived or declined submissions can never be edited.
     if ($authorSubmission->getStatus() == STATUS_ARCHIVED || $authorSubmission->getStatus() == STATUS_DECLINED) {
         return false;
     }
     // If the last recorded editorial decision on the current stage
     // was "Revisions Required", the author may edit the submission.
     $decisions = $authorSubmission->getDecisions($authorSubmission->getCurrentStage());
     $decision = array_shift($decisions);
     if ($decision == SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS) {
         return true;
     }
     // If there are open reviews for the submission, it may not be edited.
     $assignments = $authorSubmission->getReviewAssignments(null);
     if (is_array($assignments)) {
         foreach ($assignments as $round => $roundAssignments) {
             if (is_array($roundAssignments)) {
                 foreach ($roundAssignments as $assignment) {
                     if (!$assignment->getCancelled() && !$assignment->getReplaced() && !$assignment->getDeclined() && $assignment->getDateCompleted() == null && $assignment->getDateNotified() != null) {
                         return false;
                     }
                 }
             }
         }
     }
     // If the conference isn't closed, the author may edit the submission.
     if (strtotime($schedConf->getEndDate()) > time()) {
         return true;
     }
     // Otherwise, edits are not allowed.
     return false;
 }
コード例 #4
0
 /**
  * Display conference author index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $rangeInfo =& Handler::getRangeInfo('submissions');
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     if ($sort == 'status') {
         // FIXME Does not pass $rangeInfo else we only get partial results
         $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, null, $sort, $sortDirection);
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $submissions->toArray();
         if ($sortDirection == 'DESC') {
             $submissionsArray = array_reverse($submissionsArray);
         }
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
         usort($submissionsArray, $compare);
         // Convert submission array back to an ItemIterator class
         import('core.ArrayItemIterator');
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     } else {
         $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, $rangeInfo, $sort, $sortDirection);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
     $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
     if (Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) || Validation::isTrackDirector($schedConf->getConferenceId(), $schedConf->getId())) {
         // Directors or track directors may always submit
         $acceptingSubmissions = true;
     } elseif (!$submissionsOpenDate || !$submissionsCloseDate || time() < $submissionsOpenDate) {
         // Too soon
         $acceptingSubmissions = false;
         $notAcceptingSubmissionsMessage = __('author.submit.notAcceptingYet');
     } elseif (time() > $submissionsCloseDate) {
         // Too late
         $acceptingSubmissions = false;
         $notAcceptingSubmissionsMessage = __('author.submit.submissionDeadlinePassed', array('closedDate' => strftime(Config::getVar('general', 'date_format_short'), $submissionsCloseDate)));
     } else {
         $acceptingSubmissions = true;
     }
     $templateMgr->assign('acceptingSubmissions', $acceptingSubmissions);
     if (isset($notAcceptingSubmissionsMessage)) {
         $templateMgr->assign('notAcceptingSubmissionsMessage', $notAcceptingSubmissionsMessage);
     }
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('author/index.tpl');
 }
コード例 #5
0
ファイル: SubmitHandler.inc.php プロジェクト: ramonsodoma/ocs
 /**
  * Validation check for submission.
  * Checks that paper ID is valid, if specified.
  * @param $request object
  * @param $paperId int
  * @param $step int
  */
 function validate($request, $paperId = null, $step = false)
 {
     parent::validate();
     $conference =& $request->getConference();
     $schedConf =& $request->getSchedConf();
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $user =& $request->getUser();
     if ($step !== false && ($step < 1 || $step > 5 || !isset($paperId) && $step != 1)) {
         $request->redirect(null, null, null, 'submit', array(1));
     }
     $paper = null;
     if ($paperId) {
         // Check that paper exists for this conference and user and that submission is incomplete
         $paper =& $paperDao->getPaper((int) $paperId);
         if (!$paper || $paper->getUserId() !== $user->getId() || $paper->getSchedConfId() !== $schedConf->getId()) {
             $request->redirect(null, null, null, 'submit');
         }
         if ($step !== false && $step > $paper->getSubmissionProgress()) {
             $request->redirect(null, null, null, 'submit');
         }
     } else {
         // If the paper does not exist, require that the
         // submission window be open or that this user be a
         // director or track director.
         import('classes.schedConf.SchedConfAction');
         $schedConf =& $request->getSchedConf();
         if (!$schedConf || !SchedConfAction::submissionsOpen($schedConf) && !Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) && !Validation::isTrackDirector($schedConf->getConferenceId())) {
             $request->redirect(null, null, 'author', 'index');
         }
     }
     $this->paper =& $paper;
     return true;
 }
コード例 #6
0
 /**
  * Return an instance of the template manager.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  * @return TemplateManager the template manager object
  */
 function &getManager($request = null)
 {
     $instance =& Registry::get('templateManager', true, null);
     if ($instance === null) {
         $instance = new TemplateManager($request);
     }
     $supportedLocales = AppLocale::getSupportedLocales();
     $instance->assign('supportedLocales', $supportedLocales);
     $instance->assign('localePrecedence', AppLocale::getLocalePrecedence());
     $instance->assign('requestedPage', Request::getRequestedPage());
     $instance->assign('requestedOp', Request::getRequestedOp());
     $conference =& Request::getConference();
     if (isset($conference)) {
         $instance->assign('conferenceId', $conference->getId());
         $instance->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
         $instance->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
         $schedConf =& Request::getSchedConf();
         if (isset($schedConf)) {
             $instance->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
             $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
             $user = Request::getUser();
             if (isset($user)) {
                 $instance->assign('isRegistrationUser', $registrationDao->isValidRegistrationByUser($user->getUserId(), $schedConf->getId()));
             }
         }
     }
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_OCS_ADMIN, LOCALE_COMPONENT_OCS_DIRECTOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_SUBMISSION));
     // FIXME: For timeline constants
     return $instance;
 }
コード例 #7
0
ファイル: SchedConfAction.inc.php プロジェクト: artkuo/ocs
 /**
  * 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;
 }
コード例 #8
0
 /**
  * Validate that user is a track director in the selected conference.
  * Redirects to user index page if not properly authenticated.
  */
 function validate($request)
 {
     parent::validate();
     $conference =& $request->getConference();
     $schedConf =& $request->getSchedConf();
     $page = $request->getRequestedPage();
     if (!isset($conference) || !isset($schedConf)) {
         Validation::redirectLogin();
     }
     if ($page == ROLE_PATH_TRACK_DIRECTOR && !Validation::isTrackDirector($conference->getId(), $schedConf->getId())) {
         Validation::redirectLogin();
     }
     if ($page == ROLE_PATH_DIRECTOR && !Validation::isDirector($conference->getId(), $schedConf->getId())) {
         Validation::redirectLogin();
     }
 }
コード例 #9
0
ファイル: EmailHandler.inc.php プロジェクト: ramonsodoma/ocs
 function email($args)
 {
     $this->validate();
     $this->setupTemplate(true);
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $templateMgr =& TemplateManager::getManager();
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     // See if this is the Director or Manager and an email template has been chosen
     $template = Request::getUserVar('template');
     if (!$conference || empty($template) || !Validation::isConferenceManager() && !Validation::isDirector() && !Validation::isTrackDirector()) {
         $template = null;
     }
     // Determine whether or not this account is subject to
     // email sending restrictions.
     $canSendUnlimitedEmails = Validation::isSiteAdmin();
     $unlimitedEmailRoles = array(ROLE_ID_CONFERENCE_MANAGER, ROLE_ID_DIRECTOR, ROLE_ID_TRACK_DIRECTOR);
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     if ($conference) {
         $roles =& $roleDao->getRolesByUserId($user->getId(), $conference->getId());
         foreach ($roles as $role) {
             if (in_array($role->getRoleId(), $unlimitedEmailRoles)) {
                 $canSendUnlimitedEmails = true;
             }
         }
     }
     // Check when this user last sent an email, and if it's too
     // recent, make them wait.
     if (!$canSendUnlimitedEmails) {
         $dateLastEmail = $user->getDateLastEmail();
         if ($dateLastEmail && strtotime($dateLastEmail) + (int) Config::getVar('email', 'time_between_emails') > strtotime(Core::getCurrentDate())) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooSoon');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
     }
     $email = null;
     if ($paperId = Request::getUserVar('paperId')) {
         // This message is in reference to a paper.
         // Determine whether the current user has access
         // to the paper in some form, and if so, use an
         // PaperMailTemplate.
         $paperDao =& DAORegistry::getDAO('PaperDAO');
         $paper =& $paperDao->getPaper($paperId);
         $hasAccess = false;
         // First, conditions where access is OK.
         // 1. User is submitter
         if ($paper && $paper->getUserId() == $user->getId()) {
             $hasAccess = true;
         }
         // 2. User is director
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paperId);
         while ($editAssignment =& $editAssignments->next()) {
             if ($editAssignment->getDirectorId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         if (Validation::isDirector()) {
             $hasAccess = true;
         }
         // 3. User is reviewer
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         foreach ($reviewAssignmentDao->getBySubmissionId($paperId) as $reviewAssignment) {
             if ($reviewAssignment->getReviewerId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         // Last, "deal-breakers" -- access is not allowed.
         if ($paper && $paper->getSchedConfId() !== $schedConf->getId()) {
             $hasAccess = false;
         }
         if ($hasAccess) {
             import('classes.mail.PaperMailTemplate');
             $email = new PaperMailTemplate($paperDao->getPaper($paperId));
         }
     }
     if ($email === null) {
         import('classes.mail.MailTemplate');
         $email = new MailTemplate();
     }
     if (Request::getUserVar('send') && !$email->hasErrors()) {
         $recipients = $email->getRecipients();
         $ccs = $email->getCcs();
         $bccs = $email->getBccs();
         // Make sure there aren't too many recipients (to
         // prevent use as a spam relay)
         $recipientCount = 0;
         if (is_array($recipients)) {
             $recipientCount += count($recipients);
         }
         if (is_array($ccs)) {
             $recipientCount += count($ccs);
         }
         if (is_array($bccs)) {
             $recipientCount += count($bccs);
         }
         if (!$canSendUnlimitedEmails && $recipientCount > (int) Config::getVar('email', 'max_recipients')) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooManyRecipients');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
         $email->send();
         $redirectUrl = Request::getUserVar('redirectUrl');
         if (empty($redirectUrl)) {
             $redirectUrl = Request::url(null, null, 'user');
         }
         $user->setDateLastEmail(Core::getCurrentDate());
         $userDao->updateObject($user);
         Request::redirectUrl($redirectUrl);
     } else {
         $email->displayEditForm(Request::url(null, null, null, 'email'), array('redirectUrl' => Request::getUserVar('redirectUrl'), 'paperId' => $paperId), null, array('disableSkipButton' => true));
     }
 }