00001 <?php
00002
00015 import('lib.pkp.classes.form.Form');
00016
00017 class AuditorReminderForm extends Form {
00019 var $_signoff;
00020
00022 var $_monographId;
00023
00025 var $_stageId;
00026
00028 var $_publicationFormatId;
00029
00033 function AuditorReminderForm(&$signoff, $monographId, $stageId, $publicationFormatId = null) {
00034 parent::Form('controllers/grid/files/fileSignoff/form/auditorReminderForm.tpl');
00035 $this->_signoff =& $signoff;
00036 $this->_monographId = $monographId;
00037 $this->_stageId = $stageId;
00038 $this->_publicationFormatId = $publicationFormatId;
00039
00040
00041 $this->addCheck(new FormValidatorPost($this));
00042 }
00043
00044
00045
00046
00051 function &getSignoff() {
00052 return $this->_signoff;
00053 }
00054
00059 function getMonographId() {
00060 return $this->_monographId;
00061 }
00062
00067 function getStageId() {
00068 return $this->_stageId;
00069 }
00070
00075 function getPublicationFormatId() {
00076 return $this->_publicationFormatId;
00077 }
00078
00079
00080
00081
00082
00088 function initData($args, &$request) {
00089 $userDao =& DAORegistry::getDAO('UserDAO');
00090 $user =& $request->getUser();
00091 $press =& $request->getPress();
00092
00093 $signoff =& $this->getSignoff();
00094 $auditorId = $signoff->getUserId();
00095 $auditor =& $userDao->getById($auditorId);
00096
00097 $monographDao =& DAORegistry::getDAO('MonographDAO');
00098 $monograph =& $monographDao->getById($this->getMonographId());
00099
00100 import('classes.mail.MonographMailTemplate');
00101 $email = new MonographMailTemplate($monograph, 'REVIEW_REMIND');
00102
00103
00104 $signoffDueDate = strtotime($signoff->getDateUnderway());
00105 $dateFormatShort = Config::getVar('general', 'date_format_short');
00106 if ($signoffDueDate == -1) $signoffDueDate = $dateFormatShort;
00107 else $signoffDueDate = strftime($dateFormatShort, $signoffDueDate);
00108
00109 import('controllers.grid.submissions.SubmissionsListGridCellProvider');
00110 list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $monograph, $auditor->getId());
00111
00112 $dispatcher =& $request->getDispatcher();
00113 $auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('monographId' => $monograph->getId()));
00114
00115 $paramArray = array(
00116 'auditorName' => $auditor->getFullName(),
00117 'signoffDueDate' => $signoffDueDate,
00118 'editorialContactSignature' => $user->getContactSignature(),
00119 'auditorUserName' => $auditor->getUsername(),
00120 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $auditor->getUsername(), array('confirm' => Validation::generatePasswordResetHash($auditor->getId()))),
00121 'submissionAuditUrl' => $auditUrl
00122 );
00123 $email->assignParams($paramArray);
00124
00125 $this->setData('monographId', $monograph->getId());
00126 $this->setData('stageId', $this->getStageId());
00127 $this->setData('signoffId', $signoff->getId());
00128 $this->setData('publicationFormatId', $this->getPublicationFormatId());
00129 $this->setData('signoff', $signoff);
00130 $this->setData('auditorName', $auditor->getFullName());
00131 $this->setData('message', $email->getBody() . "\n" . $press->getSetting('emailSignature'));
00132 }
00133
00138 function readInputData() {
00139 $this->readUserVars(array('message'));
00140
00141 }
00142
00148 function execute($args, &$request) {
00149 $userDao =& DAORegistry::getDAO('UserDAO');
00150 $monographDao =& DAORegistry::getDAO('MonographDAO');
00151
00152 $signoff =& $this->getSignoff();
00153 $auditorId = $signoff->getUserId();
00154 $auditor =& $userDao->getById($auditorId);
00155 $monograph =& $monographDao->getById($this->getMonographId());
00156
00157 import('classes.mail.MonographMailTemplate');
00158 $email = new MonographMailTemplate($monograph, 'REVIEW_REMIND', null, null, null, false);
00159
00160 $email->addRecipient($auditor->getEmail(), $auditor->getFullName());
00161 $email->setBody($this->getData('message'));
00162 $email->send($request);
00163 }
00164 }
00165
00166 ?>