getPaper($paperId); $hasAccess = false; // First, conditions where access is OK. // 1. User is submitter if ($paper && $paper->getUserId() == $user->getUserId()) $hasAccess = true; // 2. User is director $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO'); $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paperId); while ($editAssignment =& $editAssignments->next()) { if ($editAssignment->getDirectorId() === $user->getUserId()) $hasAccess = true; } if (Validation::isDirector()) $hasAccess = true; // 3. User is reviewer $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); foreach ($reviewAssignmentDao->getReviewAssignmentsByPaperId($paperId) as $reviewAssignment) { if ($reviewAssignment->getReviewerId() === $user->getUserId()) $hasAccess = true; } // Last, "deal-breakers" -- access is not allowed. if ($paper && $paper->getSchedConfId() !== $schedConf->getSchedConfId()) $hasAccess = false; if ($hasAccess) { import('mail.PaperMailTemplate'); $email =& new PaperMailTemplate($paperDao->getPaper($paperId)); } } if ($email === null) { import('mail.MailTemplate'); $email = &new MailTemplate(); } if (Request::getUserVar('send') && !$email->hasErrors()) { $email->send(); $redirectUrl = Request::getUserVar('redirectUrl'); if (empty($redirectUrl)) $redirectUrl = Request::url(null, null, 'user'); Request::redirectUrl($redirectUrl); } else { if (!Request::getUserVar('continued')) { // Check for special cases. // 1. If the parameter presentersPaperId is set, preload // the template with all the presenters of the specified // paper ID as recipients and use the paper title // as a subject. if (Request::getUserVar('presentersPaperId')) { $paperDao = &DAORegistry::getDAO('PaperDAO'); $paper = $paperDao->getPaper(Request::getUserVar('presentersPaperId')); if (isset($paper) && $paper != null) { foreach ($paper->getPresenters() as $presenter) { $email->addRecipient($presenter->getEmail(), $presenter->getFullName()); } $email->setSubject($email->getSubject() . strip_tags($paper->getPaperTitle())); } } } $email->displayEditForm(Request::url(null, null, null, 'email'), array('redirectUrl' => Request::getUserVar('redirectUrl'), 'paperId' => $paperId), null, array('disableSkipButton' => true)); } } } ?>