classes/submission/director/DirectorAction.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('submission.trackDirector.TrackDirectorAction');
00018 
00019 class DirectorAction extends TrackDirectorAction {
00020 
00024    function DirectorAction() {
00025 
00026    }
00027 
00037    function assignDirector($paperId, $trackDirectorId, $isDirector = false, $send = false) {
00038       $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
00039       $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
00040       $userDao =& DAORegistry::getDAO('UserDAO');
00041 
00042       $user =& Request::getUser();
00043       $conference =& Request::getConference();
00044 
00045       $directorSubmission =& $directorSubmissionDao->getDirectorSubmission($paperId);
00046       $trackDirector =& $userDao->getUser($trackDirectorId);
00047       if (!isset($trackDirector)) return true;
00048 
00049       import('mail.PaperMailTemplate');
00050       $email = new PaperMailTemplate($directorSubmission, 'DIRECTOR_ASSIGN');
00051 
00052       if ($user->getId() === $trackDirectorId || !$email->isEnabled() || ($send && !$email->hasErrors())) {
00053          HookRegistry::call('DirectorAction::assignDirector', array(&$directorSubmission, &$trackDirector, &$isDirector, &$email));
00054          if ($email->isEnabled() && $user->getId() !== $trackDirectorId) {
00055             $email->setAssoc(PAPER_EMAIL_DIRECTOR_ASSIGN, PAPER_EMAIL_TYPE_DIRECTOR, $trackDirector->getId());
00056             $email->send();
00057          }
00058 
00059          $editAssignment = new EditAssignment();
00060          $editAssignment->setPaperId($paperId);
00061 
00062          // Make the selected director the new director
00063          $editAssignment->setDirectorId($trackDirectorId);
00064          $editAssignment->setDateNotified(Core::getCurrentDate());
00065          $editAssignment->setDateUnderway(null);
00066 
00067          $editAssignments =& $directorSubmission->getEditAssignments();
00068          array_push($editAssignments, $editAssignment);
00069          $directorSubmission->setEditAssignments($editAssignments);
00070 
00071          $directorSubmissionDao->updateDirectorSubmission($directorSubmission);
00072 
00073          // Add log
00074          import('paper.log.PaperLog');
00075          import('paper.log.PaperEventLogEntry');
00076          PaperLog::logEvent($paperId, PAPER_LOG_DIRECTOR_ASSIGN, LOG_TYPE_DIRECTOR, $trackDirectorId, 'log.director.directorAssigned', array('directorName' => $trackDirector->getFullName(), 'paperId' => $paperId));
00077          return true;
00078       } else {
00079          if (!Request::getUserVar('continued')) {
00080             $email->addRecipient($trackDirector->getEmail(), $trackDirector->getFullName());
00081             $paramArray = array(
00082                'editorialContactName' => $trackDirector->getFullName(),
00083                'directorUsername' => $trackDirector->getUsername(),
00084                'directorPassword' => $trackDirector->getPassword(),
00085                'editorialContactSignature' => $user->getContactSignature(),
00086                'submissionUrl' => Request::url(null, null, $isDirector?'director':'trackDirector', 'submissionReview', $paperId)
00087             );
00088             $email->assignParams($paramArray);
00089          }
00090          $email->displayEditForm(Request::url(null, null, null, 'assignDirector', 'send'), array('paperId' => $paperId, 'directorId' => $trackDirectorId));
00091          return false;
00092       }
00093    }
00094 }
00095 
00096 ?>

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