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


PHP OC_Calendar_Calendar::getUsersEmails方法代码示例

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


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

示例1: sendEmails

 /**
  * @brief use to create HTML emails and send them
  * @param $eventid The event id
  * @param $location The location
  * @param $description The description
  * @param $dtstart The start date
  * @param $dtend The end date
  *
  */
 public static function sendEmails($eventid, $summary, $location, $description, $dtstart, $dtend)
 {
     $user = \OCP\User::getUser();
     $eventsharees = array();
     $eventShareesNames = array();
     $emails = array();
     $sharedwithByEvent = \OCP\Share::getItemShared('event', $eventid);
     if (is_array($sharedwithByEvent)) {
         foreach ($sharedwithByEvent as $share) {
             if ($share['share_type'] === \OCP\Share::SHARE_TYPE_USER || $share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
                 $eventsharees[] = $share;
             }
         }
         foreach ($eventsharees as $sharee) {
             $shwth = $sharee['share_with'];
             if ($sharee['share_type'] == \OCP\Share::SHARE_TYPE_GROUP) {
                 foreach (OC_Group::usersInGroup($shwth) as $u) {
                     if (!in_array($u, $eventShareesNames)) {
                         $eventShareesNames[] = $u;
                     }
                 }
             } else {
                 if (!in_array($shwth, $eventShareesNames)) {
                     $eventShareesNames[] = $shwth;
                 }
             }
         }
     }
     foreach ($eventShareesNames as $name) {
         $result = OC_Calendar_Calendar::getUsersEmails($name);
         $emails[] = $result;
     }
     $adminmail = \OCP\Util::getDefaultEmailAddress('no-reply');
     foreach ($emails as $email) {
         if ($email === null) {
             continue;
         }
         $subject = 'Calendar Event Shared';
         $message = '<html><body>';
         $message .= '<table style="border:1px solid black;" cellpadding="10">';
         $message .= "<tr style='background: #eee;'><td colspan='2'><strong>" . $user . '</strong><strong> has shared with you an event</strong></td></tr>';
         $message .= '<tr><td><strong>Summary:</strong> </td><td>' . \OCP\Util::sanitizeHTML($summary) . '</td></tr>';
         $message .= '<tr><td><strong>Location:</strong> </td><td>' . \OCP\Util::sanitizeHTML($location) . '</td></tr>';
         $message .= '<tr><td><strong>Description:</strong> </td><td>' . \OCP\Util::sanitizeHTML($description) . '</td></tr>';
         $message .= '</table>';
         $message .= '</body></html>';
         OCP\Util::sendMail($email, \OCP\User::getDisplayName(), $subject, $message, $adminmail, $user, $html = 1);
     }
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:58,代码来源:app.php

示例2: sendEmails

 /**
  * @brief use to create HTML emails and send them
  * @param $eventid The event id
  * @param $location The location
  * @param $description The description
  * @param $dtstart The start date
  * @param $dtend The end date
  *
  */
 public static function sendEmails($eventid, $summary, $location, $description, $dtstart, $dtend)
 {
     $user = \OCP\User::getUser();
     $eventsharees = array();
     $eventShareesNames = array();
     $emails = array();
     $sharedwithByEvent = \OCP\Share::getItemShared('event', $eventid);
     if (is_array($sharedwithByEvent)) {
         foreach ($sharedwithByEvent as $share) {
             if ($share['share_type'] === \OCP\Share::SHARE_TYPE_USER || $share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
                 $eventsharees[] = $share;
             }
         }
         foreach ($eventsharees as $sharee) {
             $eventShareesNames[] = $sharee['share_with'];
         }
     }
     foreach ($eventShareesNames as $name) {
         $result = OC_Calendar_Calendar::getUsersEmails($name);
         $emails[] = $result;
     }
     $useremail = OC_Calendar_Calendar::getUsersEmails($user);
     foreach ($emails as $email) {
         if ($email === null) {
             continue;
         }
         $subject = 'Calendar Event Shared';
         $headers = 'MIME-Version: 1.0\\r\\n';
         $headers .= 'Content-Type: text/html; charset=utf-8\\r\\n';
         $headers .= 'From:' . $useremail;
         $message = '<html><body>';
         $message .= '<table style="border:1px solid black;" cellpadding="10">';
         $message .= "<tr style='background: #eee;'><td colspan='2'><strong>" . $user . '</strong><strong> has shared with you an event</strong></td></tr>';
         $message .= '<tr><td><strong>Summary:</strong> </td><td>' . \OCP\Util::sanitizeHTML($summary) . '</td></tr>';
         $message .= '<tr><td><strong>Location:</strong> </td><td>' . \OCP\Util::sanitizeHTML($location) . '</td></tr>';
         $message .= '<tr><td><strong>Description:</strong> </td><td>' . \OCP\Util::sanitizeHTML($description) . '</td></tr>';
         $message .= '</table>';
         $message .= '</body></html>';
         OCP\Util::sendMail($email, "User", $subject, $message, $useremail, $user, $html = 1, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '');
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:50,代码来源:app.php


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