コード例 #1
0
ファイル: MeetingAction.inc.php プロジェクト: elavaud/hrp_ct
 /**
  * Remind reviewers of a meeting
  * Added by ayveemallare 7/12/2011
  * Moved from sectionEditorAction by EL on March 5th
  */
 function remindUserMeeting($meeting, $addresseeId, $mSectionDecisions, $send = false)
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
     $submissions = (string) '';
     $num = 1;
     foreach ($mSectionDecisions as $mSectionDecision) {
         $sectionDecision = $sectionDecisionDao->getSectionDecision($mSectionDecision->getSectionDecisionId());
         $submissions .= $num . ". '" . $sectionDecision->getLocalizedProposalTitle() . "' " . Locale::translate('common.bySomebody') . ' ' . $sectionDecision->getAuthorString(true) . "\n";
         $num++;
     }
     $userDao =& DAORegistry::getDAO('UserDAO');
     $addressee = $userDao->getUser($addresseeId);
     $reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
     $preventAddressChanges = $reviewerAccessKeysEnabled;
     import('classes.mail.MailTemplate');
     $email = new MailTemplate('MEETING_REMIND');
     if ($preventAddressChanges) {
         $email->setAddressFieldsEnabled(false);
     }
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('MeetingAction::remindUserMeeting', array(&$meeting, &$addressee, &$submissions, &$email));
         // EL on February 26th 2013
         // Replaced "reviewerAccessKyesEnabled" by "reviewerAccessKeysEnabled"
         if ($reviewerAccessKeysEnabled) {
             import('lib.pkp.classes.security.AccessKeyManager');
             import('pages.reviewer.ReviewerHandler');
             $accessKeyManager = new AccessKeyManager();
         }
         if ($preventAddressChanges) {
             // Ensure that this messages goes to the reviewers, and the reviewers ONLY.
             $email->clearAllRecipients();
             $email->addRecipient($addressee->getEmail(), $addressee->getFullName());
         }
         $email->send();
         $meetingAttendanceDao =& DAORegistry::getDAO('MeetingAttendanceDAO');
         $meetingAttendanceDao->updateDateReminded(Core::getCurrentDate(), $addresseeId, $meeting);
         return true;
     } else {
         if (!Request::getUserVar('continued') || $preventAddressChanges) {
             $email->addRecipient($addressee->getEmail(), $addressee->getFullName());
         }
         if (!Request::getUserVar('continued')) {
             $dateLocation = (string) '';
             if ($meeting->getDate() != null) {
                 $dateLocation .= Locale::translate('editor.reports.meetingDate') . ': ' . strftime('%B %d, %Y %I:%M %p', strtotime($meeting->getDate())) . "\n";
             }
             if ($meeting->getLength() != null) {
                 $dateLocation .= Locale::translate('editor.meeting.length') . ': ' . $meeting->getLength() . "mn\n";
             }
             if ($meeting->getLocation() != null) {
                 $dateLocation .= Locale::translate('editor.meeting.location') . ': ' . $meeting->getLocation() . "\n";
             }
             $dateLocation .= Locale::translate('editor.meeting.numberOfProposalsToReview') . ': ' . count($mSectionDecisions) . "\n";
             $meetingAttendanceDao =& DAORegistry::getDAO('MeetingAttendanceDAO');
             $type = $meetingAttendanceDao->getTypeOfUser($meeting->getId(), $addressee->getId());
             $replyUrl = (string) '';
             if ($type == MEETING_INVESTIGATOR) {
                 $urlFirst = true;
                 foreach ($mSectionDecisions as $mSectionDecision) {
                     $sectionDecision = $sectionDecisionDao->getSectionDecision($mSectionDecision->getSectionDecisionId());
                     if ($urlFirst) {
                         $replyUrl .= Request::url(null, 'author', 'submission', array($sectionDecision->getArticleId(), 'submissionReview'));
                         $urlFirst = false;
                     } else {
                         $replyUrl .= '   ' . Locale::translate("common.or") . ':   ' . Request::url(null, 'author', 'submission', array($sectionDecision->getArticleId(), 'submissionReview'));
                     }
                 }
             } elseif ($type == MEETING_SECRETARY) {
                 $replyUrl = Request::url(null, 'sectionEditor', 'viewMeeting', $meeting->getId());
             } elseif ($type == MEETING_EXTERNAL_REVIEWER || $type == MEETING_ERC_MEMBER) {
                 $replyUrl = Request::url(null, 'reviewer', 'viewMeeting', $meeting->getId(), $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
             } else {
                 return false;
             }
             $replyUrl = Request::url(null, 'reviewer', 'viewMeeting', $meeting->getId(), $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
             $sectionDao =& DAORegistry::getDAO('SectionDAO');
             $erc =& $sectionDao->getSection($meeting->getUploader());
             $paramArray = array('ercTitle' => $erc->getLocalizedTitle(), 'addresseeFullName' => $addressee->getFullName(), 'submissions' => $submissions, 'dateLocation' => $dateLocation, 'replyUrl' => $replyUrl, 'secretaryName' => $user->getFullName(), 'secretaryFunctions' => $user->getErcFunction($meeting->getUploader()));
             $email->assignParams($paramArray);
         }
         // EL on February 26th 2013
         // Replaced submissionsIds by submissionIds
         // + moved the paramters as additional parameters
         $email->displayEditForm(Request::url(null, null, 'remindUserMeeting', array($meeting->getId(), $addresseeId)));
         return false;
     }
     return true;
 }