本文整理汇总了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);
}
}
示例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 = '');
}
}