/** * View conference event log by record type. */ function conferenceEventLogType($args) { $assocType = isset($args[1]) ? (int) $args[0] : null; $assocId = isset($args[2]) ? (int) $args[1] : null; $this->validate(); $this->setupTemplate(true); $conference =& Request::getConference(); $rangeInfo =& Handler::getRangeInfo('eventLogEntries', array($assocType, $assocId)); $logDao =& DAORegistry::getDAO('ConferenceEventLogDAO'); while (true) { $eventLogEntries =& $logDao->getConferenceLogEntriesByAssoc($conference->getId(), null, $assocType, $assocId, $rangeInfo); if ($eventLogEntries->isInBounds()) { break; } unset($rangeInfo); $rangeInfo =& $eventLogEntries->getLastPageRangeInfo(); unset($eventLogEntries); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('showBackLink', true); $templateMgr->assign('isDirector', Validation::isDirector()); $templateMgr->assign_by_ref('conference', $conference); $templateMgr->assign_by_ref('eventLogEntries', $eventLogEntries); $templateMgr->display('manager/conferenceEventLog.tpl'); }
/** * Display the form. * @param $request Request */ function display($request) { $conferenceDao = DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getNames(); $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) { $canOnlyRead = false; $canOnlyReview = false; } // Remove the notification setting categories that the user will not be receiving (to simplify the form) $notificationSettingCategories = $this->_getNotificationSettingCategories(); if ($canOnlyRead || $canOnlyReview) { unset($notificationSettingCategories['submissions']); } if ($canOnlyRead) { unset($notificationSettingCategories['reviewing']); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('notificationSettingCategories', $notificationSettingCategories); $templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap()); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display($request); }
/** * Display the form. */ function display() { $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getConferenceTitles(); $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) { $canOnlyRead = false; $canOnlyReview = false; } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display(); }
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())); }
/** * 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; } }
/** * 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'); }
/** * Given a scheduled conference, set up the template with all the * required variables for schedConf/view.tpl to function properly. * @param $schedConf object The scheduled conference to display * the cover page will be displayed. Otherwise table of contents * will be displayed. */ function setupTemplate(&$conference, &$schedConf) { parent::setupTemplate(); $templateMgr =& TemplateManager::getManager(); Locale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER)); // Ensure the user is entitled to view the scheduled conference... if (isset($schedConf) && ($conference->getEnabled() || (Validation::isDirector($conference->getId()) || Validation::isConferenceManager($conference->getId())))) { // Assign header and content for home page $templateMgr->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle(true)); $templateMgr->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo(true)); $templateMgr->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('homeHeaderTitleImageAltText')); $templateMgr->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('homeHeaderLogoImageAltText')); $templateMgr->assign_by_ref('schedConf', $schedConf); $templateMgr->assign('additionalHomeContent', $conference->getLocalizedSetting('additionalHomeContent')); } else { Request::redirect(null, 'index'); } if ($styleFileName = $schedConf->getStyleFileName()) { import('file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getConferenceFilesPath($conference->getId()) . '/' . $styleFileName); } }
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; }
/** * Validate that the user is the assigned track director for * the paper, or is a managing director. * Redirects to trackDirector index page if validation fails. * @param $paperId int Paper ID to validate * @param $access int Optional name of access level required -- see TRACK_DIRECTOR_ACCESS_... constants */ function validate($request, $paperId, $access = null) { parent::validate($request); $isValid = true; $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO'); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $user =& $request->getUser(); $trackDirectorSubmission =& $trackDirectorSubmissionDao->getTrackDirectorSubmission($paperId); if ($trackDirectorSubmission == null) { $isValid = false; } else { if ($trackDirectorSubmission->getSchedConfId() != $schedConf->getId()) { $isValid = false; } else { if ($trackDirectorSubmission->getDateSubmitted() == null) { $isValid = false; } else { $templateMgr =& TemplateManager::getManager(); // If this user isn't the submission's director, they don't have access. $editAssignments =& $trackDirectorSubmission->getEditAssignments(); $wasFound = false; foreach ($editAssignments as $editAssignment) { if ($editAssignment->getDirectorId() == $user->getId()) { $wasFound = true; } } if (!$wasFound && !Validation::isDirector()) { $isValid = false; } } } } if (!$isValid) { $request->redirect(null, null, null, $request->getRequestedPage()); } // If necessary, note the current date and time as the "underway" date/time $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO'); $editAssignments =& $trackDirectorSubmission->getEditAssignments(); foreach ($editAssignments as $editAssignment) { if ($editAssignment->getDirectorId() == $user->getId() && $editAssignment->getDateUnderway() === null) { $editAssignment->setDateUnderway(Core::getCurrentDate()); $editAssignmentDao->updateEditAssignment($editAssignment); } } $this->submission =& $trackDirectorSubmission; return true; }
/** * 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; }
/** * 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; }
/** * Email director decision comment. * @param $trackDirectorSubmission object * @param $send boolean */ function emailDirectorDecisionComment($trackDirectorSubmission, $send) { $userDao =& DAORegistry::getDAO('UserDAO'); $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO'); $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $templateName = null; $reviewMode = $trackDirectorSubmission->getReviewMode(); $stages = $trackDirectorSubmission->getDecisions(); if (is_array($stages)) { $isAbstract = array_pop(array_keys($stages)) == REVIEW_STAGE_ABSTRACT; } if (isset($stages) && is_array($stages)) { $decisions = array_pop($stages); // If this round has no decision, revert to prior round if (empty($decisions)) { $decisions = array_pop($stages); } } if (isset($decisions) && is_array($decisions)) { $lastDecision = array_pop($decisions); } if (isset($lastDecision) && is_array($lastDecision)) { switch ($lastDecision['decision']) { case SUBMISSION_DIRECTOR_DECISION_INVITE: $templateName = $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_PAPER_INVITE' : 'SUBMISSION_ABSTRACT_ACCEPT'; break; case SUBMISSION_DIRECTOR_DECISION_ACCEPT: $templateName = 'SUBMISSION_PAPER_ACCEPT'; break; case SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS: $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_REVISE' : 'SUBMISSION_PAPER_REVISE'; break; case SUBMISSION_DIRECTOR_DECISION_DECLINE: $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_DECLINE' : 'SUBMISSION_PAPER_DECLINE'; break; } } $user =& Request::getUser(); import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($trackDirectorSubmission, $templateName); if ($send && !$email->hasErrors()) { HookRegistry::call('TrackDirectorAction::emailDirectorDecisionComment', array(&$trackDirectorSubmission, &$send)); $email->send(); $paperComment = new PaperComment(); $paperComment->setCommentType(COMMENT_TYPE_DIRECTOR_DECISION); $paperComment->setRoleId(Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR); $paperComment->setPaperId($trackDirectorSubmission->getPaperId()); $paperComment->setAuthorId($trackDirectorSubmission->getUserId()); $paperComment->setCommentTitle($email->getSubject()); $paperComment->setComments($email->getBody()); $paperComment->setDatePosted(Core::getCurrentDate()); $paperComment->setViewable(true); $paperComment->setAssocId($trackDirectorSubmission->getPaperId()); $paperCommentDao->insertPaperComment($paperComment); return true; } else { if (!Request::getUserVar('continued')) { $authorUser =& $userDao->getUser($trackDirectorSubmission->getUserId()); $authorEmail = $authorUser->getEmail(); $email->addRecipient($authorEmail, $authorUser->getFullName()); if ($schedConf->getSetting('notifyAllAuthorsOnDecision')) { foreach ($trackDirectorSubmission->getAuthors() as $author) { if ($author->getEmail() != $authorEmail) { $email->addCc($author->getEmail(), $author->getFullName()); } } } $email->assignParams(array('conferenceDate' => strftime(Config::getVar('general', 'date_format_short'), $schedConf->getSetting('startDate')), 'authorName' => $authorUser->getFullName(), 'conferenceTitle' => $conference->getConferenceTitle(), 'editorialContactSignature' => $user->getContactSignature(), 'locationCity' => $schedConf->getSetting('locationCity'), 'paperTitle' => $trackDirectorSubmission->getLocalizedTitle())); } elseif (Request::getUserVar('importPeerReviews')) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $hasBody = false; for ($stage = $trackDirectorSubmission->getCurrentStage(); $stage == REVIEW_STAGE_ABSTRACT || $stage == REVIEW_STAGE_PRESENTATION; $stage--) { $reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByPaperId($trackDirectorSubmission->getPaperId(), $stage); $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForStage($trackDirectorSubmission->getPaperId(), $stage); $body = ''; foreach ($reviewAssignments as $reviewAssignment) { // If the reviewer has completed the assignment, then import the review. if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { // Get the comments associated with this review assignment $paperComments =& $paperCommentDao->getPaperComments($trackDirectorSubmission->getPaperId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId()); if ($paperComments) { $body .= "------------------------------------------------------\n"; $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n"; if (is_array($paperComments)) { foreach ($paperComments as $comment) { // If the comment is viewable by the author, then add the comment. if ($comment->getViewable()) { $body .= String::html2utf(strip_tags(str_replace(array('<p>', '<br>', '<br/>'), array("\n", "\n", "\n"), $comment->getComments()))) . "\n\n"; $hasBody = true; } } } $body .= "------------------------------------------------------\n\n"; } if ($reviewFormId = $reviewAssignment->getReviewFormId()) { $reviewId = $reviewAssignment->getId(); $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO'); $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO'); $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId); if (!$paperComments) { $body .= "------------------------------------------------------\n"; $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n\n"; } foreach ($reviewFormElements as $reviewFormElement) { if ($reviewFormElement->getIncluded()) { $body .= strip_tags($reviewFormElement->getLocalizedQuestion()) . ": \n"; $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId()); if ($reviewFormResponse) { $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses(); if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) { if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) { foreach ($reviewFormResponse->getValue() as $value) { $body .= "\t" . String::html2utf(strip_tags($possibleResponses[$value - 1]['content'])) . "\n"; } } else { $body .= "\t" . String::html2utf(strip_tags($possibleResponses[$reviewFormResponse->getValue() - 1]['content'])) . "\n"; } $body .= "\n"; } else { $body .= "\t" . String::html2utf(strip_tags($reviewFormResponse->getValue())) . "\n\n"; } } } } $body .= "------------------------------------------------------\n\n"; $hasBody = true; } } // if } // foreach if ($hasBody) { $oldBody = $email->getBody(); if (!empty($oldBody)) { $oldBody .= "\n"; } $email->setBody($oldBody . $body); break; } } // foreach } $email->displayEditForm(Request::url(null, null, null, 'emailDirectorDecisionComment', 'send'), array('paperId' => $trackDirectorSubmission->getPaperId()), 'submission/comment/directorDecisionEmail.tpl', array('isADirector' => true)); return false; } }
/** * 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; }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($request, $subclass = false, $paperId = 0, $parentPage = null) { parent::setupTemplate(); Locale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OCS_AUTHOR)); $templateMgr =& TemplateManager::getManager(); $isDirector = Validation::isDirector(); $pageHierarchy = array(); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $templateMgr->assign('helpTopicId', $isDirector ? 'editorial.directorsRole' : 'editorial.trackDirectorsRole'); if ($schedConf) { $pageHierarchy[] = array($request->url(null, null, 'index'), $schedConf->getFullTitle(), true); } elseif ($conference) { $pageHierarchy[] = array($request->url(null, 'index', 'index'), $conference->getConferenceTitle(), true); } $roleSymbolic = $isDirector ? 'director' : 'trackDirector'; $roleKey = $isDirector ? 'user.role.director' : 'user.role.trackDirector'; $pageHierarchy[] = array($request->url(null, null, 'user'), 'navigation.user'); $pageHierarchy[] = array($request->url(null, null, $roleSymbolic), $roleKey); if ($subclass) { $pageHierarchy[] = array($request->url(null, null, $roleSymbolic), 'paper.submissions'); } import('classes.submission.trackDirector.TrackDirectorAction'); $submissionCrumb = TrackDirectorAction::submissionBreadcrumb($paperId, $parentPage, $roleSymbolic); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
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)); } }
/** * Get a list of the most 'privileged' roles a user has associated with an paper. This will * determine the URL to point them to for notifications about papers. Returns roles in * order of 'importance' * @param $paperId * @return array */ function _getHighestPrivilegedRolesForPaper(&$request, $paperId) { $user =& $request->getUser(); $userId = $user->getId(); $roleDao = DAORegistry::getDAO('RoleDAO'); /* @var $roleDao RoleDAO */ $paperDao = DAORegistry::getDAO('PaperDAO'); /* @var $paperDao PaperDAO */ $paper =& $paperDao->getPaper($paperId); $schedConfDao = DAORegistry::getDAO('SchedConfDAO'); /* @var $schedConfDao SchedConfDAO */ $schedConf = $schedConfDao->getById($paper->getSchedConfId()); $roles = array(); // Check if user is director if (Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId())) { $roles[] = ROLE_ID_DIRECTOR; } $editAssignmentDao = DAORegistry::getDAO('EditAssignmentDAO'); /* @var $editAssignmentDao EditAssignmentDAO */ $editAssignments =& $editAssignmentDao->getTrackDirectorAssignmentsByPaperId($paperId); while ($editAssignment =& $editAssignments->next()) { if ($userId == $editAssignment->getDirectorId()) { $roles[] = ROLE_ID_TRACK_DIRECTOR; } unset($editAssignment); } // Check if user is author if ($userId == $paper->getUserId()) { $roles[] = ROLE_ID_AUTHOR; } // Check if user is reviewer $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($paperId); foreach ($reviewAssignments as $reviewAssignment) { if ($userId == $reviewAssignment->getReviewerId()) { $roles[] = ROLE_ID_REVIEWER; } } return $roles; }