当前位置: 首页>>代码示例>>PHP>>正文


PHP MailTemplate::displayEditForm方法代码示例

本文整理汇总了PHP中MailTemplate::displayEditForm方法的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate::displayEditForm方法的具体用法?PHP MailTemplate::displayEditForm怎么用?PHP MailTemplate::displayEditForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailTemplate的用法示例。


在下文中一共展示了MailTemplate::displayEditForm方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: email

 /**
  * Send an email to a user or group of users.
  */
 function email($args)
 {
     $this->validate();
     $this->setupTemplate(true);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', 'journal.users.emailUsers');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $site =& Request::getSite();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     import('classes.mail.MailTemplate');
     $email = new MailTemplate(Request::getUserVar('template'), Request::getUserVar('locale'));
     if (Request::getUserVar('send') && !$email->hasErrors()) {
         $email->send();
         Request::redirect(null, Request::getRequestedPage());
     } else {
         $email->assignParams();
         // FIXME Forces default parameters to be assigned (should do this automatically in MailTemplate?)
         if (!Request::getUserVar('continued')) {
             if (($groupId = Request::getUserVar('toGroup')) != '') {
                 // Special case for emailing entire groups:
                 // Check for a group ID and add recipients.
                 $groupDao =& DAORegistry::getDAO('GroupDAO');
                 $group =& $groupDao->getGroup($groupId);
                 if ($group && $group->getAssocId() == $journal->getId() && $group->getAssocType() == ASSOC_TYPE_JOURNAL) {
                     $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
                     $memberships =& $groupMembershipDao->getMemberships($group->getId());
                     $memberships =& $memberships->toArray();
                     foreach ($memberships as $membership) {
                         $user =& $membership->getUser();
                         $email->addRecipient($user->getEmail(), $user->getFullName());
                     }
                 }
             }
             if (count($email->getRecipients()) == 0) {
                 $email->addRecipient($user->getEmail(), $user->getFullName());
             }
         }
         $email->displayEditForm(Request::url(null, null, 'email'), array(), 'manager/people/email.tpl');
     }
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:44,代码来源:ManagerHandler.inc.php

示例2: removeBookForReviewAuthor

 /**
  * Remove book reviewer and reset book for review.
  */
 function removeBookForReviewAuthor($args = array(), &$request)
 {
     $this->setupTemplate();
     if (empty($args)) {
         $request->redirect(null, 'editor');
     }
     $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     $returnPage = $request->getUserVar('returnPage');
     if ($returnPage != null) {
         $validPages =& $this->getValidReturnPages();
         if (!in_array($returnPage, $validPages)) {
             $returnPage = null;
         }
     }
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $bookId = (int) $args[0];
     $bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
     // Ensure book for review is for this journal
     if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
         import('classes.mail.MailTemplate');
         $email = new MailTemplate('BFR_REVIEWER_REMOVED');
         $send = $request->getUserVar('send');
         // Editor has filled out mail form or skipped mail
         if ($send && !$email->hasErrors()) {
             // Update book for review
             $book =& $bfrDao->getBookForReview($bookId);
             $book->setStatus(BFR_STATUS_AVAILABLE);
             $book->setUserId(null);
             $book->setDateRequested(null);
             $book->setDateAssigned(null);
             $book->setDateDue(null);
             $book->setDateMailed(null);
             $book->setDateSubmitted(null);
             $book->setArticleId(null);
             $bfrDao->updateObject($book);
             $email->send();
             $user =& $request->getUser();
             import('classes.notification.NotificationManager');
             $notificationManager = new NotificationManager();
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_BOOK_AUTHOR_REMOVED);
             $request->redirect(null, 'editor', 'booksForReview', $returnPage);
             // Display mail form for editor
         } else {
             if (!$request->getUserVar('continued')) {
                 $book =& $bfrDao->getBookForReview($bookId);
                 $userFullName = $book->getUserFullName();
                 $userEmail = $book->getUserEmail();
                 $paramArray = array('authorName' => strip_tags($userFullName), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'editorialContactSignature' => String::html2text($book->getEditorContactSignature()));
                 $email->addRecipient($userEmail, $userFullName);
                 $email->setReplyTo($book->getEditorEmail(), $book->getEditorFullName());
                 $email->assignParams($paramArray);
             }
             $returnUrl = $request->url(null, 'editor', 'removeBookForReviewAuthor', $bookId, array('returnPage' => $returnPage));
             $email->displayEditForm($returnUrl);
         }
     }
     $request->redirect(null, 'editor', 'booksForReview', $returnPage);
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:62,代码来源:BooksForReviewEditorHandler.inc.php

示例3: emailAuthor

 /**
  * Display the "email author"
  * @param $args array
  * @param $request Request
  */
 function emailAuthor($args, &$request)
 {
     $router =& $request->getRouter();
     $this->setupTemplate();
     $paperId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? (int) $args[1] : 0;
     $this->validate($request, $paperId, $galleyId);
     $conference =& $router->getContext($request, CONTEXT_CONFERENCE);
     $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF);
     $paper =& $this->paper;
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $conferenceRt =& $rtDao->getConferenceRTByConference($conference);
     $user =& $request->getUser();
     if (!$conferenceRt || !$conferenceRt->getEmailAuthor() || !$user) {
         $request->redirect(null, null, $router->getRequestedPage($request));
     }
     import('mail.MailTemplate');
     $email = new MailTemplate();
     if ($request->getUserVar('send') && !$email->hasErrors()) {
         $email->send();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->display('rt/sent.tpl');
     } else {
         if (!$request->getUserVar('continued')) {
             $email->setSubject('[' . $schedConf->getLocalizedSetting('acronym') . '] ' . strip_tags($paper->getLocalizedTitle()));
             $authors =& $paper->getAuthors();
             $author =& $authors[0];
             $email->addRecipient($author->getEmail(), $author->getFullName());
         }
         $email->displayEditForm($router->url($request, null, null, null, 'emailAuthor', array($paperId, $galleyId)), null, 'rt/email.tpl', array('op' => 'emailAuthor'));
     }
 }
开发者ID:jalperin,项目名称:ocs,代码行数:37,代码来源:RTHandler.inc.php

示例4: emailAuthor

 /**
  * Display the "email author" form
  * @param $args array
  * @param $request Request
  */
 function emailAuthor($args, &$request)
 {
     $router =& $request->getRouter();
     $this->setupTemplate();
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? (int) $args[1] : 0;
     $this->validate($request, $articleId, $galleyId);
     $journal =& $router->getContext($request);
     $article =& $this->article;
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $journalRt =& $rtDao->getJournalRTByJournal($journal);
     $user =& $request->getUser();
     if (!$journalRt || !$journalRt->getEmailAuthor() || !$user) {
         $request->redirect(null, $router->getRequestedPage($request));
     }
     import('classes.mail.MailTemplate');
     $email = new MailTemplate();
     $email->setAddressFieldsEnabled(false);
     if ($request->getUserVar('send') && !$email->hasErrors()) {
         $authors =& $article->getAuthors();
         $author =& $authors[0];
         $email->addRecipient($author->getEmail(), $author->getFullName());
         $email->send();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->display('rt/sent.tpl');
     } else {
         if (!$request->getUserVar('continued')) {
             $email->setSubject('[' . $journal->getLocalizedSetting('initials') . '] ' . strip_tags($article->getLocalizedTitle()));
         }
         $email->displayEditForm($router->url($request, null, null, 'emailAuthor', array($articleId, $galleyId)), null, 'rt/email.tpl', array('op' => 'emailAuthor'));
     }
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:37,代码来源:RTHandler.inc.php

示例5: requestBookForReview

 /**
  * Author requests a book for review.
  */
 function requestBookForReview($args = array(), $request)
 {
     $this->setupTemplate($request);
     if (empty($args)) {
         $request->redirect(null, 'user');
     }
     $bfrPlugin = PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     $journal = $request->getJournal();
     $journalId = $journal->getId();
     $bookId = (int) $args[0];
     $bfrDao = DAORegistry::getDAO('BookForReviewDAO');
     // Ensure book for review is for this journal
     if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
         import('lib.pkp.classes.mail.MailTemplate');
         $email = new MailTemplate('BFR_BOOK_REQUESTED');
         $send = $request->getUserVar('send');
         // Author has filled out mail form or decided to skip email
         if ($send && !$email->hasErrors()) {
             // Update book for review as requested
             $book = $bfrDao->getBookForReview($bookId);
             $status = $book->getStatus();
             $bfrPlugin->import('classes.BookForReview');
             // Ensure book for review is avaliable
             if ($status == BFR_STATUS_AVAILABLE) {
                 $user = $request->getUser();
                 $userId = $user->getId();
                 $book->setStatus(BFR_STATUS_REQUESTED);
                 $book->setUserId($userId);
                 $book->setDateRequested(date('Y-m-d H:i:s', time()));
                 $bfrDao->updateObject($book);
                 $email->send();
                 import('classes.notification.NotificationManager');
                 $notificationManager = new NotificationManager();
                 $notificationManager->createTrivialNotification($userId, NOTIFICATION_TYPE_BOOK_REQUESTED);
             }
             $request->redirect(null, 'author', 'booksForReview');
             // Display mail form for author
         } else {
             if (!$request->getUserVar('continued')) {
                 $book = $bfrDao->getBookForReview($bookId);
                 $status = $book->getStatus();
                 $bfrPlugin->import('classes.BookForReview');
                 // Ensure book for review is avaliable
                 if ($status == BFR_STATUS_AVAILABLE) {
                     $user = $request->getUser();
                     $userId = $user->getId();
                     $editorFullName = $book->getEditorFullName();
                     $editorEmail = $book->getEditorEmail();
                     $paramArray = array('editorName' => strip_tags($editorFullName), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'authorContactSignature' => String::html2text($user->getContactSignature()));
                     $email->addRecipient($editorEmail, $editorFullName);
                     $email->assignParams($paramArray);
                 }
                 $returnUrl = $request->url(null, 'author', 'requestBookForReview', $bookId);
                 $email->displayEditForm($returnUrl);
             }
         }
     }
     $request->redirect(null, 'booksForReview');
 }
开发者ID:utlib,项目名称:ojs,代码行数:62,代码来源:BooksForReviewAuthorHandler.inc.php

示例6: email

 function email($args, $request)
 {
     $this->validate();
     $this->setupTemplate($request, true);
     $templateMgr =& TemplateManager::getManager();
     $userDao = DAORegistry::getDAO('UserDAO');
     $user =& $request->getUser();
     // See if this is the Editor or Manager and an email template has been chosen
     $template = $request->getUserVar('template');
     if (empty($template) || !Validation::isSiteAdmin()) {
         $template = null;
     }
     // Determine whether or not this account is subject to
     // email sending restrictions.
     $canSendUnlimitedEmails = Validation::isSiteAdmin();
     $unlimitedEmailRoles = array(ROLE_ID_SITE_ADMIN);
     $roleDao = DAORegistry::getDAO('RoleDAO');
     $roles =& $roleDao->getRolesByUserId($user->getId());
     foreach ($roles as $role) {
         if (in_array($role->getRoleId(), $unlimitedEmailRoles)) {
             $canSendUnlimitedEmails = true;
         }
     }
     // Check when this user last sent an email, and if it's too
     // recent, make them wait.
     if (!$canSendUnlimitedEmails) {
         $dateLastEmail = $user->getDateLastEmail();
         if ($dateLastEmail && strtotime($dateLastEmail) + (int) Config::getVar('email', 'time_between_emails') > strtotime(Core::getCurrentDate())) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooSoon');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
     }
     import('classes.mail.MailTemplate');
     $email = new MailTemplate($template);
     if ($request->getUserVar('send') && !$email->hasErrors()) {
         $recipients = $email->getRecipients();
         $ccs = $email->getCcs();
         $bccs = $email->getBccs();
         // Make sure there aren't too many recipients (to
         // prevent use as a spam relay)
         $recipientCount = 0;
         if (is_array($recipients)) {
             $recipientCount += count($recipients);
         }
         if (is_array($ccs)) {
             $recipientCount += count($ccs);
         }
         if (is_array($bccs)) {
             $recipientCount += count($bccs);
         }
         if (!$canSendUnlimitedEmails && $recipientCount > (int) Config::getVar('email', 'max_recipients')) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooManyRecipients');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
         $email->send();
         $redirectUrl = $request->getUserVar('redirectUrl');
         if (empty($redirectUrl)) {
             $redirectUrl = $request->url(null, 'user');
         }
         $user->setDateLastEmail(Core::getCurrentDate());
         $userDao->updateObject($user);
         $request->redirectUrl($redirectUrl);
     } else {
         $email->displayEditForm($request->url(null, null, 'email'), array('redirectUrl' => $request->getUserVar('redirectUrl')), null, array('disableSkipButton' => true));
     }
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:72,代码来源:EmailHandler.inc.php

示例7: remindUserMeeting

 /**
  * 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;
 }
开发者ID:elavaud,项目名称:hrp_ct,代码行数:95,代码来源:MeetingAction.inc.php

示例8: emailRep

 /**
  * Send the request email to DOAJ.
  * @param $journal object
  */
 function emailRep(&$journal, $send = false)
 {
     $user =& Request::getUser();
     $issn = $journal->getSetting('printIssn');
     import('mail.MailTemplate');
     $mail = new MailTemplate('DOAJ_EMAIL_REP');
     if ($send && !$mail->hasErrors()) {
         $mail->send();
         Request::redirect(null, 'manager', 'importexport');
     } else {
         $paramArray = array('username' => $user->getFirstName() . ' ' . $user->getLastName(), 'journalName' => $journal->getLocalizedTitle(), 'isOpenAccess' => $journal->getSetting('publishingMode') == PUBLISHING_MODE_OPEN ? 'Yes' : 'No', 'altTitle' => $journal->getLocalizedSetting('abbreviation'), 'journalURL' => $journal->getUrl(), 'hasAuthorFee' => $journal->getSetting('submissionFee') > 0 ? 'Yes' : 'No', 'infoURL' => $journal->getUrl(), 'isPeerReviewed' => 'Yes', 'isOriginalResearch' => '', 'isAcademic' => '', 'isActive' => $this->compareToCurDate($journal->getId()) ? 'Yes' : 'No', 'hasPrintedForm' => $issn != '' ? 'Yes' : 'No', 'hasEmbargo' => '', 'accessFrom' => $journal->getSetting('initialYear'), 'firstVolume' => $journal->getSetting('initialVolume'), 'firstIssue' => $journal->getSetting('initialNumber'), 'issn' => $issn, 'eissn' => $journal->getSetting('onlineIssn'), 'publisherName' => $journal->getSetting('publisherInstitution'), 'country' => $user->getCountry(), 'languages' => Locale::getLocale(), 'keywords' => $journal->getLocalizedSetting('searchKeywords'), 'contactName' => $journal->getSetting('contactName'), 'contactEmail' => $journal->getSetting('contactEmail'), 'frequency' => $journal->getSetting('volumePerYear') * $journal->getSetting('issuePerVolume'), 'articlesPerIssue' => $this->getArticlesPerIssue($journal->getId()));
         $mail->assignParams($paramArray);
         $mail->addRecipient('Sonja.Brage@lub.lu.se', 'Sonja Brage');
         $mail->displayEditForm(Request::url(null, 'manager', 'importexport', array('plugin', $this->getName(), 'email')));
     }
 }
开发者ID:philschatz,项目名称:ojs,代码行数:20,代码来源:DOAJPlugin.inc.php

示例9: email


//.........这里部分代码省略.........
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
     }
     $email = null;
     if ($articleId = Request::getUserVar('articleId')) {
         // This message is in reference to an article.
         // Determine whether the current user has access
         // to the article in some form, and if so, use an
         // ArticleMailTemplate.
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $article =& $articleDao->getArticle($articleId);
         $hasAccess = false;
         // First, conditions where access is OK.
         // 1. User is submitter
         if ($article && $article->getUserId() == $user->getId()) {
             $hasAccess = true;
         }
         // 2. User is section editor of article or full editor
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByArticleId($articleId);
         while ($editAssignment =& $editAssignments->next()) {
             if ($editAssignment->getEditorId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         if (Validation::isEditor($journal->getId())) {
             $hasAccess = true;
         }
         // 3. User is reviewer
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         foreach ($reviewAssignmentDao->getBySubmissionId($articleId) as $reviewAssignment) {
             if ($reviewAssignment->getReviewerId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         // 4. User is copyeditor
         $copyedSignoff =& $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
         if ($copyedSignoff && $copyedSignoff->getUserId() === $user->getId()) {
             $hasAccess = true;
         }
         // 5. User is layout editor
         $layoutSignoff =& $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
         if ($layoutSignoff && $layoutSignoff->getUserId() === $user->getId()) {
             $hasAccess = true;
         }
         // 6. User is proofreader
         $proofSignoff =& $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
         if ($proofSignoff && $proofSignoff->getUserId() === $user->getId()) {
             $hasAccess = true;
         }
         // Last, "deal-breakers" -- access is not allowed.
         if (!$article || $article && $article->getJournalId() !== $journal->getId()) {
             $hasAccess = false;
         }
         if ($hasAccess) {
             import('classes.mail.ArticleMailTemplate');
             $email = new ArticleMailTemplate($articleDao->getArticle($articleId, $template));
         }
     }
     if ($email === null) {
         import('classes.mail.MailTemplate');
         $email = new MailTemplate($template);
     }
     if (Request::getUserVar('send') && !$email->hasErrors()) {
         $recipients = $email->getRecipients();
         $ccs = $email->getCcs();
         $bccs = $email->getBccs();
         // Make sure there aren't too many recipients (to
         // prevent use as a spam relay)
         $recipientCount = 0;
         if (is_array($recipients)) {
             $recipientCount += count($recipients);
         }
         if (is_array($ccs)) {
             $recipientCount += count($ccs);
         }
         if (is_array($bccs)) {
             $recipientCount += count($bccs);
         }
         if (!$canSendUnlimitedEmails && $recipientCount > (int) Config::getVar('email', 'max_recipients')) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooManyRecipients');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
         $email->send();
         $redirectUrl = Request::getUserVar('redirectUrl');
         if (empty($redirectUrl)) {
             $redirectUrl = Request::url(null, 'user');
         }
         $user->setDateLastEmail(Core::getCurrentDate());
         $userDao->updateObject($user);
         Request::redirectUrl($redirectUrl);
     } else {
         $email->displayEditForm(Request::url(null, null, 'email'), array('redirectUrl' => Request::getUserVar('redirectUrl'), 'articleId' => $articleId), null, array('disableSkipButton' => true, 'articleId' => $articleId));
     }
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:101,代码来源:EmailHandler.inc.php

示例10: email


//.........这里部分代码省略.........
     if ($conference) {
         $roles =& $roleDao->getRolesByUserId($user->getId(), $conference->getId());
         foreach ($roles as $role) {
             if (in_array($role->getRoleId(), $unlimitedEmailRoles)) {
                 $canSendUnlimitedEmails = true;
             }
         }
     }
     // Check when this user last sent an email, and if it's too
     // recent, make them wait.
     if (!$canSendUnlimitedEmails) {
         $dateLastEmail = $user->getDateLastEmail();
         if ($dateLastEmail && strtotime($dateLastEmail) + (int) Config::getVar('email', 'time_between_emails') > strtotime(Core::getCurrentDate())) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooSoon');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
     }
     $email = null;
     if ($paperId = Request::getUserVar('paperId')) {
         // This message is in reference to a paper.
         // Determine whether the current user has access
         // to the paper in some form, and if so, use an
         // PaperMailTemplate.
         $paperDao =& DAORegistry::getDAO('PaperDAO');
         $paper =& $paperDao->getPaper($paperId);
         $hasAccess = false;
         // First, conditions where access is OK.
         // 1. User is submitter
         if ($paper && $paper->getUserId() == $user->getId()) {
             $hasAccess = true;
         }
         // 2. User is director
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paperId);
         while ($editAssignment =& $editAssignments->next()) {
             if ($editAssignment->getDirectorId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         if (Validation::isDirector()) {
             $hasAccess = true;
         }
         // 3. User is reviewer
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         foreach ($reviewAssignmentDao->getBySubmissionId($paperId) as $reviewAssignment) {
             if ($reviewAssignment->getReviewerId() === $user->getId()) {
                 $hasAccess = true;
             }
         }
         // Last, "deal-breakers" -- access is not allowed.
         if ($paper && $paper->getSchedConfId() !== $schedConf->getId()) {
             $hasAccess = false;
         }
         if ($hasAccess) {
             import('classes.mail.PaperMailTemplate');
             $email = new PaperMailTemplate($paperDao->getPaper($paperId));
         }
     }
     if ($email === null) {
         import('classes.mail.MailTemplate');
         $email = new MailTemplate();
     }
     if (Request::getUserVar('send') && !$email->hasErrors()) {
         $recipients = $email->getRecipients();
         $ccs = $email->getCcs();
         $bccs = $email->getBccs();
         // Make sure there aren't too many recipients (to
         // prevent use as a spam relay)
         $recipientCount = 0;
         if (is_array($recipients)) {
             $recipientCount += count($recipients);
         }
         if (is_array($ccs)) {
             $recipientCount += count($ccs);
         }
         if (is_array($bccs)) {
             $recipientCount += count($bccs);
         }
         if (!$canSendUnlimitedEmails && $recipientCount > (int) Config::getVar('email', 'max_recipients')) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooManyRecipients');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
         $email->send();
         $redirectUrl = Request::getUserVar('redirectUrl');
         if (empty($redirectUrl)) {
             $redirectUrl = Request::url(null, null, 'user');
         }
         $user->setDateLastEmail(Core::getCurrentDate());
         $userDao->updateObject($user);
         Request::redirectUrl($redirectUrl);
     } else {
         $email->displayEditForm(Request::url(null, null, null, 'email'), array('redirectUrl' => Request::getUserVar('redirectUrl'), 'paperId' => $paperId), null, array('disableSkipButton' => true));
     }
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:101,代码来源:EmailHandler.inc.php

示例11: sendEmailRTOs

 function sendEmailRTOs($send = false)
 {
     import('classes.mail.MailTemplate');
     $email = new MailTemplate();
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('SendEmailHandler::sendEmailRTOs', array(&$send));
         $email->send();
         Request::redirect(null, null, 'index');
     } else {
         $sender =& Request::getUser();
         $journal =& Request::getJournal();
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         //Get RTOs
         $authors = $roleDao->getUsersByRoleId(ROLE_ID_AUTHOR);
         //Get already added recipients
         $recipients =& $email->getRecipients();
         if (isset($recipients)) {
             $totalRecipients = count($recipients);
         } else {
             $totalRecipients = 0;
         }
         while (!$authors->eof()) {
             $author =& $authors->next();
             // Check if new recipient is not already added
             $isNotInTheList = true;
             if (isset($recipients)) {
                 foreach ($recipients as $recipient) {
                     if ($recipient['email'] == $author->getEmail()) {
                         $isNotInTheList = false;
                     }
                 }
             }
             //Add new recipients
             if ($sender->getId() != $author->getId() && $isNotInTheList == true) {
                 $email->addRecipient($author->getEmail(), $author->getFullName());
                 $totalRecipients++;
             }
             unset($author);
         }
         $email->displayEditForm(Request::url(null, null, 'sendEmailRTOs', 'send'), null, 'email/email_hiderecipients.tpl', array('totalRecipients' => $totalRecipients));
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:42,代码来源:SendEmailHandler.inc.php


注:本文中的MailTemplate::displayEditForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。