本文整理匯總了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 = '');
}
}