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


PHP Notifier::prepareEmailAddress方法代码示例

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


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

示例1: tool_mass_mailer

 /**
  * Send multiple emails using this simple tool
  *
  * @param void
  * @return null
  */
 function tool_mass_mailer()
 {
     $tool = AdministrationTools::getByName('mass_mailer');
     if (!$tool instanceof AdministrationTool) {
         flash_error(lang('administration tool dnx', 'test_mail_settings'));
         $this->redirectTo('administration', 'tools');
     }
     // if
     $massmailer_data = array_var($_POST, 'massmailer');
     tpl_assign('tool', $tool);
     tpl_assign('grouped_users', Users::getGroupedByCompany());
     tpl_assign('massmailer_data', $massmailer_data);
     if (is_array($massmailer_data)) {
         try {
             $subject = trim(array_var($massmailer_data, 'subject'));
             $message = trim(array_var($massmailer_data, 'message'));
             $errors = array();
             if ($subject == '') {
                 $errors[] = lang('massmailer subject required');
             }
             // if
             if ($message == '') {
                 $errors[] = lang('massmailer message required');
             }
             // if
             $users = Users::getAll();
             $recipients = array();
             if (is_array($users)) {
                 foreach ($users as $user) {
                     if (array_var($massmailer_data, 'user_' . $user->getId()) == 'checked') {
                         $recipients[] = Notifier::prepareEmailAddress($user->getEmail(), $user->getDisplayName());
                     }
                     // if
                 }
                 // foreach
             }
             // if
             if (!count($recipients)) {
                 $errors[] = lang('massmailer select recipients');
             }
             // if
             if (count($errors)) {
                 throw new FormSubmissionErrors($errors);
             }
             // if
             if (Notifier::sendEmail($recipients, Notifier::prepareEmailAddress(logged_user()->getEmail(), logged_user()->getDisplayName()), $subject, $message)) {
                 flash_success(lang('success massmail'));
             } else {
                 flash_error(lang('error massmail'));
             }
             // if
             $this->redirectToUrl($tool->getToolUrl());
         } catch (Exception $e) {
             tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
开发者ID:ukd1,项目名称:Project-Pier,代码行数:65,代码来源:AdministrationController.class.php

示例2: send_reports

 function send_reports()
 {
     $company = Companies::findById(1);
     $lTime = time() + 60 * 60 * $company->getTimezone();
     $dayOfWeek = date("l", $lTime);
     $footer = '<a href="' . externalUrl(ROOT_URL) . '">' . externalUrl(ROOT_URL) . "</a>";
     $people = Reminders::findAll(array('conditions' => 'reports_enabled = 1 and report_day = "' . $dayOfWeek . '"'));
     if (is_array($people) && count($people)) {
         foreach ($people as $person) {
             tpl_assign('settings', $person);
             $user = Users::findById($person->getUserId());
             tpl_assign('user', $user);
             $offset = 60 * 60 * $user->getTimezone();
             tpl_assign('offset', $offset);
             $allProjects = $user->getProjects();
             $emailBody = '';
             $recipient = Notifier::prepareEmailAddress($user->getEmail(), $user->getDisplayName());
             foreach ($allProjects as $project) {
                 if ($project->isActive() || $project->getCompletedOn()->getLeftInDays() > -7) {
                     tpl_assign('project', $project);
                     $condition = 'project_id = ' . $project->getId();
                     $condition .= " and is_private = 0 and is_silent = 0";
                     if (!$person->getReportsIncludeEveryone()) {
                         $condition .= ' and taken_by_id = ' . $user->getId();
                     }
                     $logs = array();
                     if ($person->getReportsIncludeActivity()) {
                         $condition .= " and created_on > Interval -7 day + now()";
                         $logs = ApplicationLogs::findAll(array('conditions' => $condition));
                     }
                     tpl_assign('logs', $logs);
                     $taskLists = $project->getAllTaskLists();
                     $emailTaskLists = array();
                     if (is_array($taskLists) && count($taskLists)) {
                         foreach ($taskLists as $taskList) {
                             $condition = 'task_list_id = ' . $taskList->getId();
                             if (!$person->getReportsIncludeEveryone()) {
                                 $condition .= " and assigned_to_user_id = " . $user->getId();
                             }
                             $condition .= " and completed_on > Interval -7 day + now()";
                             $tasks = ProjectTasks::findAll(array('conditions' => $condition));
                             if (is_array($tasks) && count($tasks)) {
                                 $emailTaskLists[] = $taskList;
                             }
                         }
                     }
                     if (count($emailTaskLists) || count($logs)) {
                         tpl_assign('taskLists', $emailTaskLists);
                         $emailBody .= tpl_fetch(get_template_path('report_per_project', 'reminders'));
                         if ($person->getReportsSummarizedBy()) {
                             try {
                                 Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Project Report - " . $project->getObjectName(), $emailBody . $footer, 'text/html');
                                 // send
                                 $emailBody = '';
                             } catch (Exception $e) {
                                 echo $e;
                             }
                         }
                     }
                 }
             }
             if (strlen($emailBody) && !$person->getReportsSummarizedBy()) {
                 $time = time() + 60 * 60 * $user->getTimezone();
                 try {
                     Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Activity Report - " . gmdate('Y/m/d', $time), $emailBody . $footer, 'text/html');
                     // send
                     $emailBody = '';
                 } catch (Exception $e) {
                     echo $e;
                 }
             }
         }
     }
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:74,代码来源:RemindersController.class.php


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