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


PHP MailTemplate::getRecipients方法代码示例

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


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

示例1: email

 /**
  * Send an email to a user or group of users.
  */
 function email($args)
 {
     $this->validate();
     $this->setupTemplate(true);
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', 'conference.users.emailUsers');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $site =& Request::getSite();
     $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, 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, ASSOC_TYPE_SCHED_CONF, $schedConf->getId());
                 if ($group) {
                     $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, null, 'email'), array(), 'manager/people/email.tpl');
     }
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:45,代码来源:ManagerHandler.inc.php

示例2: email


//.........这里部分代码省略.........
     $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');
         }
         if (is_a($email, 'ArticleMailTemplate')) {
             // Make sure the email gets logged if needed
             $email->send($request);
         } else {
             $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:farhanabbas1983,项目名称:ojs-1,代码行数:101,代码来源:EmailHandler.inc.php

示例3: 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

示例4: email

 function email($args)
 {
     $this->validate();
     $this->setupTemplate(true);
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $templateMgr =& TemplateManager::getManager();
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     // See if this is the Director or Manager and an email template has been chosen
     $template = Request::getUserVar('template');
     if (!$conference || empty($template) || !Validation::isConferenceManager() && !Validation::isDirector() && !Validation::isTrackDirector()) {
         $template = null;
     }
     // Determine whether or not this account is subject to
     // email sending restrictions.
     $canSendUnlimitedEmails = Validation::isSiteAdmin();
     $unlimitedEmailRoles = array(ROLE_ID_CONFERENCE_MANAGER, ROLE_ID_DIRECTOR, ROLE_ID_TRACK_DIRECTOR);
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     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);
         }
//.........这里部分代码省略.........
开发者ID:ramonsodoma,项目名称:ocs,代码行数:101,代码来源:EmailHandler.inc.php

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