/** * Setup common template variables. * @param $level int set to 0 if caller is at the same level as this handler in the hierarchy; otherwise the number of levels below this handler */ function setupTemplate($request, $level = DIRECTOR_TRACK_HOME, $paperId = 0, $parentPage = null) { parent::setupTemplate($request); $templateMgr =& TemplateManager::getManager(); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $pageHierarchy = array(); if ($schedConf) { $pageHierarchy[] = array($request->url(null, null, 'index'), $schedConf->getFullTitle(), true); } elseif ($conference) { $pageHierarchy[] = array($request->url(null, 'index', 'index'), $conference->getConferenceTitle(), true); } $pageHierarchy[] = array($request->url(null, null, 'user'), 'navigation.user'); if ($level == DIRECTOR_TRACK_SUBMISSIONS) { $pageHierarchy[] = array($request->url(null, null, 'director'), 'user.role.director'); $pageHierarchy[] = array($request->url(null, null, 'director', 'submissions'), 'paper.submissions'); } import('classes.submission.trackDirector.TrackDirectorAction'); $submissionCrumb = TrackDirectorAction::submissionBreadcrumb($paperId, $parentPage, 'director'); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
/** * 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; }
/** * Constructor **/ function SubmissionCommentsHandler() { parent::TrackDirectorHandler(); }
/** * Email a director decision comment. */ function emailDirectorDecisionComment() { $paperId = (int) Request::getUserVar('paperId'); $submissionEditHandler = new SubmissionEditHandler(); $submissionEditHandler->validate($paperId); $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO'); $submission =& $trackDirectorSubmissionDao->getTrackDirectorSubmission($paperId); parent::setupTemplate(true); if (TrackDirectorAction::emailDirectorDecisionComment($submission, Request::getUserVar('send'))) { if (Request::getUserVar('blindCcReviewers')) { $this->blindCcReviewsToReviewers(); } else { Request::redirect(null, null, null, 'submissionReview', array($paperId)); } } }