本文整理汇总了PHP中format_text_email函数的典型用法代码示例。如果您正苦于以下问题:PHP format_text_email函数的具体用法?PHP format_text_email怎么用?PHP format_text_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_text_email函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: makeMailText
/**
* Builds and returns the body of the email notification in plain text.
*
* @param object $post
* @param object $userto
* @return string The email body in plain text format.
*/
public function makeMailText($post, $userto)
{
global $CFG, $cm;
$praxe = praxe_record::getData();
if (!isset($userto->viewfullnames[$praxe->id])) {
if (!($cm = get_coursemodule_from_instance('praxe', $praxe->id, $this->course->id))) {
print_error('Course Module ID was incorrect');
}
$modcontext = context_module::instance($cm->id);
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
} else {
$viewfullnames = $userto->viewfullnames[$praxe->id];
}
//$by = New stdClass;
//$by->name = fullname($userfrom, $viewfullnames);
//$by->date = userdate($post->modified, "", $userto->timezone);
//$strbynameondate = get_string('bynameondate', 'forum', $by);
$strpraxes = get_string('modulenameplural', 'praxe');
$posttext = '';
$posttext = $this->course->shortname . " -> " . $strpraxes . " -> " . format_string($praxe->name, true);
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= format_string($this->subject, true);
//$posttext .= "\n".$strbynameondate."\n";
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= format_text_email(trusttext_strip($post), FORMAT_PLAIN);
$posttext .= "\n\n---------------------------------------------------------------------\n";
$site = get_site();
foreach ($this->linkstofoot as $link) {
$posttext .= $link->text . ": " . $link->link . "\t";
//$posttext .= get_string('confirmorrefusestudent','praxe').": ".$CFG->wwwroot.'/course/view.php?id='.$cm->id."\n\n";
}
$posttext .= "\n\n" . $site->shortname . ": " . $CFG->wwwroot . "\n";
return $posttext;
}
开发者ID:jerab,项目名称:moodle-mod-praxe,代码行数:41,代码来源:mailing.php
示例2: test_format_text_email
public function test_format_text_email()
{
$this->assertSame("This is a TEST", format_text_email('<p>This is a <strong>test</strong></p>', FORMAT_HTML));
$this->assertSame("This is a TEST", format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>', FORMAT_HTML));
$this->assertSame('& so is this', format_text_email('& so is this', FORMAT_HTML));
$this->assertSame('Two bullets: ' . core_text::code2utf8(8226) . ' *', format_text_email('Two bullets: • •', FORMAT_HTML));
$this->assertSame(core_text::code2utf8(0x7fd2) . core_text::code2utf8(0x7fd2), format_text_email('習習', FORMAT_HTML));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:8,代码来源:weblib_test.php
示例3: test_format_text_email
function test_format_text_email()
{
$this->assertEqual('This is a test', format_text_email('<p>This is a <strong>test</strong></p>', FORMAT_HTML));
$this->assertEqual('This is a test', format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>', FORMAT_HTML));
$this->assertEqual('& so is this', format_text_email('<p>& so is this</p>', FORMAT_HTML));
$tl = textlib_get_instance();
$this->assertEqual('Two bullets: ' . $tl->code2utf8(8226) . ' ' . $tl->code2utf8(8226), format_text_email('<p>Two bullets: • •</p>', FORMAT_HTML));
$this->assertEqual($tl->code2utf8(0x7fd2) . $tl->code2utf8(0x7fd2), format_text_email('<p>習習</p>', FORMAT_HTML));
}
开发者ID:r007,项目名称:PMoodle,代码行数:9,代码来源:testweblib.php
示例4: apply
function apply($discussion, $all, $selected, $formdata)
{
global $COURSE, $USER, $CFG;
// Begin with standard text
$a = (object) array('name' => fullname($USER, true));
// TODO Is this needed? It doesn't work; $CFG->stylesheets not there
// $allhtml = "<head>";
// foreach ($CFG->stylesheets as $stylesheet) {
// $allhtml .= '<link rel="stylesheet" type="text/css" href="' .
// $stylesheet . '" />' . "\n";
// }
// $allhtml .= "</head>\n';
$allhtml = "<body id='forumng-email'>\n";
$preface = get_string('forward_preface', 'forumngfeature_forward', $a);
$allhtml .= $preface;
$alltext = format_text_email($preface, FORMAT_HTML);
// Include intro if specified
if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message['text'])) {
$alltext .= "\n" . mod_forumng_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
// Add intro
$message = trusttext_strip($formdata->message['text']);
$allhtml .= format_text($message, $formdata->message['format']);
$alltext .= format_text_email($message, $formdata->message['format']);
}
// Get list of all post ids in discussion order
$alltext .= "\n" . mod_forumng_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
$poststext = '';
$postshtml = '';
$discussion->build_selected_posts_email($selected, $poststext, $postshtml);
$alltext .= $poststext;
$allhtml .= $postshtml . '</body>';
$emails = preg_split('~[; ]+~', $formdata->email);
$subject = $formdata->subject;
foreach ($emails as $email) {
$fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => 0);
$from = $USER;
$from->maildisplay = 999;
// Nasty hack required for OU moodle
if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $formdata->email);
}
}
// Log that it was sent
$discussion->log('forward discussion', $formdata->email);
if (!empty($formdata->ccme)) {
if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $USER->email);
}
}
$out = $discussion->init_page($discussion->get_moodle_url(), $this->get_page_name());
print $out->header();
print $out->box(get_string('forward_done', 'forumngfeature_forward'));
print $out->continue_button(new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array()));
print $out->footer();
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:57,代码来源:forward.php
示例5: apply
public function apply($discussion, $all, $selected, $formdata)
{
global $COURSE, $USER, $CFG;
// Begin with standard text.
$a = (object) array('name' => fullname($USER, true));
$allhtml = "<body id='forumng-email'>\n";
$preface = get_string('forward_preface', 'forumngfeature_forward', $a);
$allhtml .= $preface;
$alltext = format_text_email($preface, FORMAT_HTML);
// Include intro if specified.
if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message['text'])) {
$alltext .= "\n" . \mod_forumng_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
// Add intro.
$message = trusttext_strip($formdata->message['text']);
$allhtml .= format_text($message, $formdata->message['format']);
$alltext .= format_text_email($message, $formdata->message['format']);
}
// Get list of all post ids in discussion order.
$alltext .= "\n" . \mod_forumng_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
$poststext = '';
$postshtml = '';
$discussion->build_selected_posts_email($selected, $poststext, $postshtml);
$alltext .= $poststext;
$allhtml .= $postshtml . '</body>';
$emails = preg_split('~[; ]+~', $formdata->email);
$subject = $formdata->subject;
foreach ($emails as $email) {
$fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => -1);
$from = $USER;
$from->maildisplay = 999;
// Nasty hack required for OU moodle.
if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $formdata->email);
}
}
// Log that it was sent.
$params = array('context' => $discussion->get_forum()->get_context(), 'objectid' => $discussion->get_id(), 'other' => array('logurl' => $discussion->get_log_url(), 'info' => $formdata->email));
$event = \forumngfeature_forward\event\discussion_forwarded::create($params);
$event->add_record_snapshot('course_modules', $discussion->get_course_module());
$event->add_record_snapshot('course', $discussion->get_course());
$event->trigger();
if (!empty($formdata->ccme)) {
if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $USER->email);
}
}
if ($this->printout) {
$out = $discussion->init_page($discussion->get_moodle_url(), $this->get_page_name());
print $out->header();
print $out->box(get_string('forward_done', 'forumngfeature_forward'));
print $out->continue_button(new \moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array()));
print $out->footer();
}
}
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:56,代码来源:post_selector.php
示例6: apply
function apply($discussion, $all, $selected, $formdata)
{
global $COURSE, $USER, $CFG;
// Begin with standard text
$a = (object) array('name' => fullname($USER, true));
$allhtml = "<head>";
foreach ($CFG->stylesheets as $stylesheet) {
$allhtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
}
$allhtml .= "</head>\n<body id='forumng-email'>\n";
$preface = get_string('forward_preface', 'forumng', $a);
$allhtml .= $preface;
$alltext = format_text_email($preface, FORMAT_HTML);
// Include intro if specified
if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message)) {
$alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
// Add intro
$message = trusttext_strip(stripslashes($formdata->message));
$allhtml .= format_text($message, $formdata->format);
$alltext .= format_text_email($message, $formdata->format);
}
// Get list of all post ids in discussion order
$alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
$poststext = '';
$postshtml = '';
$discussion->build_selected_posts_email($selected, $poststext, $postshtml);
$alltext .= $poststext;
$allhtml .= $postshtml . '</body>';
$emails = preg_split('~[; ]+~', $formdata->email);
$subject = stripslashes($formdata->subject);
foreach ($emails as $email) {
$fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => 0);
$from = $USER;
$from->maildisplay = 999;
// Nasty hack required for OU moodle
if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $formdata->email);
}
}
// Log that it was sent
$discussion->log('forward discussion', $formdata->email);
if (!empty($formdata->ccme)) {
if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $USER->email);
}
}
$discussion->print_subpage_header($this->get_page_name());
print_box(get_string('forward_done', 'forumng'));
print_continue('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN));
print_footer($COURSE);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:53,代码来源:forward.php
示例7: forum_make_mail_text
/**
* Builds and returns the body of the email notification in plain text.
*
* @global object
* @global object
* @uses CONTEXT_MODULE
* @param object $course
* @param object $cm
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @param boolean $bare
* @param string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8].
* @return string The email body in plain text format.
*/
function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare = false, $replyaddress = null)
{
global $CFG, $USER;
$modcontext = context_module::instance($cm->id);
if (!isset($userto->viewfullnames[$forum->id])) {
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
} else {
$viewfullnames = $userto->viewfullnames[$forum->id];
}
if (!isset($userto->canpost[$discussion->id])) {
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course, $modcontext);
} else {
$canreply = $userto->canpost[$discussion->id];
}
$by = new stdClass();
$by->name = fullname($userfrom, $viewfullnames);
$by->date = userdate($post->modified, "", $userto->timezone);
$strbynameondate = get_string('bynameondate', 'forum', $by);
$strforums = get_string('forums', 'forum');
$canunsubscribe = !\mod_forum\subscriptions::is_forcesubscribed($forum);
$posttext = '';
if (!$bare) {
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
$posttext .= "{$shortname} -> {$strforums} -> " . format_string($forum->name, true);
if ($discussion->name != $forum->name) {
$posttext .= " -> " . format_string($discussion->name, true);
}
}
// add absolute file links
$post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $modcontext->id, 'mod_forum', 'post', $post->id);
$posttext .= "\n";
$posttext .= $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->id;
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= format_string($post->subject, true);
if ($bare) {
$posttext .= " ({$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id})";
}
$posttext .= "\n" . $strbynameondate . "\n";
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= format_text_email($post->message, $post->messageformat);
$posttext .= "\n\n";
$posttext .= forum_print_attachments($post, $cm, "text");
if (!$bare) {
if ($canreply) {
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= get_string("postmailinfo", "forum", $shortname) . "\n";
$posttext .= "{$CFG->wwwroot}/mod/forum/post.php?reply={$post->id}\n";
}
if ($canunsubscribe) {
if (\mod_forum\subscriptions::is_subscribed($userto->id, $forum, null, $cm)) {
// If subscribed to this forum, offer the unsubscribe link.
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= get_string("unsubscribe", "forum");
$posttext .= ": {$CFG->wwwroot}/mod/forum/subscribe.php?id={$forum->id}\n";
}
// Always offer the unsubscribe from discussion link.
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= get_string("unsubscribediscussion", "forum");
$posttext .= ": {$CFG->wwwroot}/mod/forum/subscribe.php?id={$forum->id}&d={$discussion->id}\n";
}
}
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= get_string("digestmailpost", "forum");
$posttext .= ": {$CFG->wwwroot}/mod/forum/index.php?id={$forum->course}\n";
if ($replyaddress) {
$posttext .= "\n\n" . get_string('replytopostbyemail', 'mod_forum');
}
return $posttext;
}
开发者ID:adonm,项目名称:learning,代码行数:86,代码来源:lib.php
示例8: format_message_text
/**
* The plaintext version of the e-mail message.
*
* @param \stdClass $cm
* @param \stdClass $post
* @return string
*/
public function format_message_text($cm, $post)
{
$message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', \context_module::instance($cm->id)->id, 'mod_forum', 'post', $post->id);
return format_text_email($message, $post->messageformat);
}
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:renderer_textemail.php
示例9: forum_make_mail_text
/**
* Builds and returns the body of the email notification in plain text.
*
* @param object $course
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @param boolean $bare
* @return string The email body in plain text format.
*/
function forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $userto, $bare = false)
{
global $CFG, $USER;
if (!isset($userto->viewfullnames[$forum->id])) {
if (!($cm = get_coursemodule_from_instance('forum', $forum->id, $course->id))) {
error('Course Module ID was incorrect');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
} else {
$viewfullnames = $userto->viewfullnames[$forum->id];
}
if (!isset($userto->canpost[$discussion->id])) {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course, $modcontext);
} else {
$canreply = $userto->canpost[$discussion->id];
}
$by = new stdClass();
$by->name = fullname($userfrom, $viewfullnames);
$by->date = userdate($post->modified, "", $userto->timezone);
$strbynameondate = get_string('bynameondate', 'forum', $by);
$strforums = get_string('forums', 'forum');
$canunsubscribe = !forum_is_forcesubscribed($forum);
$posttext = '';
if (!$bare) {
$posttext = "{$course->shortname} -> {$strforums} -> " . format_string($forum->name, true);
if ($discussion->name != $forum->name) {
$posttext .= " -> " . format_string($discussion->name, true);
}
}
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= format_string($post->subject, true);
if ($bare) {
$posttext .= " ({$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id})";
}
$posttext .= "\n" . $strbynameondate . "\n";
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= format_text_email(trusttext_strip($post->message), $post->format);
$posttext .= "\n\n";
if ($post->attachment) {
$post->course = $course->id;
$post->forum = $forum->id;
$posttext .= forum_print_attachments($post, "text");
}
if (!$bare && $canreply) {
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= get_string("postmailinfo", "forum", $course->shortname) . "\n";
$posttext .= "{$CFG->wwwroot}/mod/forum/post.php?reply={$post->id}\n";
}
if (!$bare && $canunsubscribe) {
$posttext .= "\n---------------------------------------------------------------------\n";
$posttext .= get_string("unsubscribe", "forum");
$posttext .= ": {$CFG->wwwroot}/mod/forum/subscribe.php?id={$forum->id}\n";
}
return $posttext;
}
开发者ID:r007,项目名称:PMoodle,代码行数:69,代码来源:lib.php
示例10: send_copy
/**
* Send a copy to the user email according to the user's preferences
* @param block_jmail_message $message A full message object
* @return boolean True if the message have been sent succesfully
*/
private function send_copy($message)
{
global $DB, $CFG;
$mailresult = true;
$site = get_site();
// We ensure that is a message sent and approved
if (!$message->timesent or !$message->approved) {
return false;
}
add_to_log($this->course->id, 'jmail', 'message sent');
$message = $message->full();
if ($message->destinataries) {
$url = $CFG->wwwroot . '/blocks/jmail/mailbox.php?id=' . $this->course->id;
foreach ($message->destinataries as $type => $destinataries) {
foreach ($destinataries as $dest) {
$userprefs = $this->load_user_preferences($dest->userid);
if ($userprefs->receivecopies && ($userto = $DB->get_record('user', array('id' => $dest->userid)))) {
$bodytext = get_string('emailcopyheader', 'block_jmail', $url) . "<br /><br />";
$bodytext .= $message->body . "<br /><br />";
$bodytext .= get_string('emailcopyfooter', 'block_jmail', $url);
$bodytext = format_text_email($bodytext, FORMAT_HTML);
$mailresult = email_to_user($userto, $site->shortname, $message->subject, $bodytext, '', '', '', true, '');
}
}
}
}
// TODO, handle possible errors
return true;
}
开发者ID:borrown,项目名称:moodle-block_jmail,代码行数:34,代码来源:block_jmail_mailbox.class.php
示例11: message_post_message
function message_post_message($userfrom, $userto, $message, $format, $messagetype)
{
global $CFG, $SITE, $USER;
/// Set up current language to suit the receiver of the message
$savelang = $USER->lang;
if (!empty($userto->lang)) {
$USER->lang = $userto->lang;
}
/// Save the new message in the database
$savemessage = NULL;
$savemessage->useridfrom = $userfrom->id;
$savemessage->useridto = $userto->id;
$savemessage->message = $message;
$savemessage->format = $format;
$savemessage->timecreated = time();
$savemessage->messagetype = 'direct';
if ($CFG->messaging) {
if (!($savemessage->id = insert_record('message', $savemessage))) {
return false;
}
$emailforced = false;
} else {
// $CFG->messaging is not on, we need to force sending of emails
$emailforced = true;
$savemessage->id = true;
}
/// Check to see if anything else needs to be done with it
$preference = (object) get_user_preferences(NULL, NULL, $userto->id);
if ($emailforced || (!isset($preference->message_emailmessages) || $preference->message_emailmessages)) {
// Receiver wants mail forwarding
if (!isset($preference->message_emailtimenosee)) {
$preference->message_emailtimenosee = 10;
}
if (!isset($preference->message_emailformat)) {
$preference->message_emailformat = FORMAT_HTML;
}
if ($emailforced || time() - $userto->lastaccess > (int) $preference->message_emailtimenosee * 60) {
// Long enough
$message = stripslashes_safe($message);
$tagline = get_string('emailtagline', 'message', $SITE->shortname);
$messagesubject = preg_replace('/\\s+/', ' ', strip_tags($message));
// make sure it's all on one line
$messagesubject = message_shorten_message($messagesubject, 30) . '...';
$messagetext = format_text_email($message, $format) . "\n\n--\n" . $tagline . "\n" . "{$CFG->wwwroot}/message/index.php?popup=1";
if (isset($preference->message_emailformat) and $preference->message_emailformat == FORMAT_HTML) {
$messagehtml = format_text($message, $format);
// MDL-10294, do not print link if messaging is disabled
if ($CFG->messaging) {
$messagehtml .= '<hr /><p><a href="' . $CFG->wwwroot . '/message/index.php?popup=1">' . $tagline . '</a></p>';
}
} else {
$messagehtml = NULL;
}
if (!empty($preference->message_emailaddress)) {
$userto->email = $preference->message_emailaddress;
// Use custom messaging address
}
if (email_to_user($userto, $userfrom, $messagesubject, $messagetext, $messagehtml)) {
$CFG->messagewasjustemailed = true;
}
sleep(3);
}
}
$USER->lang = $savelang;
// restore original language
return $savemessage->id;
}
开发者ID:r007,项目名称:PMoodle,代码行数:67,代码来源:lib.php
示例12: reservasalas_sendMail
function reservasalas_sendMail($values, $error, $user, $asistentes, $eventname, $buildingid)
{
global $USER, $DB;
$userfrom = core_user::get_noreply_user();
$userfrom->maildisplay = true;
$sql = "SELECT s.nombre as sedenombre, e.nombre as edificionombre\n\t\t\tFROM {reservasalas_edificios} AS e JOIN {reservasalas_sedes} AS s ON (e.sedes_id = s.id)\n\t\t\tWHERE s.id = ?";
$names = $DB->get_record_sql($sql, array($buildingid));
$message = get_string("dear", "local_reservasalas") . $USER->firstname . " " . $USER->lastname . ": \n \n";
$message .= get_string("bookinginformation", "local_reservasalas") . "\n \n";
$message .= get_string("site", "local_reservasalas") . ": " . $names->sedenombre . "\n";
$message .= get_string("buildings", "local_reservasalas") . ": " . $names->edificionombre . "\n";
$message .= get_string("roomtype", "local_reservasalas") . ": Estudio \n";
$message .= get_string("event", "local_reservasalas") . ": " . $eventname . "\n";
$message .= get_string("assistants", "local_reservasalas") . ": " . $asistentes . "\n";
$message .= get_string("responsibility", "local_reservasalas") . ": " . $USER->firstname . " " . $USER->lastname . "\n";
$message .= get_string("rooms", "local_reservasalas") . ": \n";
foreach ($values as $value) {
$stamp = strtotime($value["fecha"]);
$day = date("l", $stamp);
$message .= get_string("date", "local_reservasalas") . ": " . $day . " " . $value["fecha"] . " - " . get_string("room", "local_reservasalas") . ": " . $value["nombresala"] . " - " . get_string("module", "local_reservasalas") . ": " . $value["nombremodulo"] . "\n";
}
// Format each "\n" into a line break
$formattedMessage = nl2br($message);
$eventdata = new stdClass();
$eventdata->component = "local_reservasalas";
// your component name
$eventdata->name = "reservenotification";
// this is the message name from messages.php
$eventdata->userfrom = $userfrom;
$eventdata->userto = $user;
$eventdata->subject = get_string("confirmationbooking", "local_reservasalas");
$eventdata->fullmessage = format_text_email($formattedMessage, FORMAT_HTML);
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = "";
$eventdata->smallmessage = "";
$eventdata->notification = 1;
// this is only set to 0 for personal messages between users
message_send($eventdata);
}
开发者ID:avillarroelp,项目名称:reservasalas,代码行数:39,代码来源:querylib.php
示例13: message_post_message
function message_post_message($userfrom, $userto, $message, $format, $messagetype)
{
global $CFG, $SITE;
/// Save the new message in the database
$savemessage = NULL;
$savemessage->useridfrom = $userfrom->id;
$savemessage->useridto = $userto->id;
$savemessage->message = $message;
$savemessage->format = $format;
$savemessage->timecreated = time();
$savemessage->messagetype = 'direct';
if (!($savemessage->id = insert_record('message', $savemessage))) {
return false;
}
/// Check to see if anything else needs to be done with it
$preference = (object) get_user_preferences(NULL, NULL, $userto->id);
if (!isset($preference->message_emailmessages) || $preference->message_emailmessages) {
// Receiver wants mail forwarding
if (!isset($preference->message_emailtimenosee)) {
$preference->message_emailtimenosee = 10;
}
if (!isset($preference->message_emailformat)) {
$preference->message_emailformat = FORMAT_HTML;
}
if (time() - $userto->lastaccess > (int) $preference->message_emailtimenosee * 60) {
// Long enough
$message = stripslashes_safe($message);
$tagline = get_string('emailtagline', 'message', $SITE->shortname);
$messagesubject = message_shorten_message(strip_tags($message), 30) . '...';
$messagetext = format_text_email($message, $format) . "\n\n--\n" . $tagline . "\n" . "{$CFG->wwwroot}/message/index.php?popup=1";
if (isset($preference->message_emailformat) and $preference->message_emailformat == FORMAT_HTML) {
$messagehtml = format_text($message, $format);
$messagehtml .= '<hr /><p><a href="' . $CFG->wwwroot . '/message/index.php?popup=1">' . $tagline . '</a></p>';
} else {
$messagehtml = NULL;
}
if (!empty($preference->message_emailaddress)) {
$userto->email = $preference->message_emailaddress;
// Use custom messaging address
}
if (email_to_user($userto, $userfrom, $messagesubject, $messagetext, $messagehtml)) {
$CFG->messagewasjustemailed = true;
}
sleep(3);
}
}
return $savemessage->id;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:48,代码来源:lib.php
示例14: get_string
// get the new name (name may change due to filename collisions)
$attachname = $um->get_new_filename();
} else {
$form->error = get_string("attachmenterror", "block_quickmail", $form->attachment);
}
} else {
$form->attachment = '';
// no attachment
}
}
// no errors, then email
if (!isset($form->error)) {
$mailedto = array();
// holds all the userid of successful emails
// get the correct formating for the emails
$form->plaintxt = format_text_email($form->message, $form->format);
// plain text
$form->html = format_text($form->message, $form->format);
// html
// run through each user id and send a copy of the email to him/her
// not sending 1 email with CC to all user ids because emails were required to be kept private
foreach ($form->mailto as $userid) {
if (!$courseusers[$userid]->emailstop) {
$mailresult = email_to_user($courseusers[$userid], $USER, $form->subject, $form->plaintxt, $form->html, $attachment, $attachname);
// checking for errors, if there is an error, store the name
if (!$mailresult || (string) $mailresult == 'emailstop') {
$form->error = get_string('emailfailerror', 'block_quickmail');
$form->usersfail['emailfail'][] = $courseusers[$userid]->lastname . ', ' . $courseusers[$userid]->firstname;
} else {
// success
$mailedto[] = $userid;
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:31,代码来源:email.php
示例15: process
function process($data)
{
global $CFG, $USER;
$this->process_referrals();
// Process Attachment
$course = get_record('course', 'id', $this->courseid);
list($attachmentname, $attachment) = $this->process_attachment($course);
// Outputing info as mtrace in case developers want to report
// as Moodle cron
mtrace('<div class="report_wrap">
<h2 class="">' . get_string('sending', 'block_student_gradeviewer') . '</h2>
<ul class="student_list">');
// Set the from here; If the teacher sends anonymously,
// then send with a no reply
$from = isset($data->anonymous) ? get_string('noreplyname') : $USER;
// Foreach user, send report to mentor
foreach ($this->users as $id => $user) {
// Find the section the user is enrolled in
$section = lookup_section($user, $course);
// Format section: DEPT 1001 - 001
$a->course = get_string('format_section', 'block_courseprefs', $section);
// Format User's fullname: Firstname Lastname
$a->user = fullname($user);
// DEPT 1001 - 001 Report For Firstname Lastname
$subject = get_string('subject_report', 'block_student_gradeviewer', $a);
// Mentee link in student_grade viewer
$grade_link = $CFG->wwwroot . '/blocks/student_gradeviewer/mentee.php?id=' . $id . ($this->courseid ? '&courseid=' . $this->courseid : '');
// Grades Overview for Firstname Lastname:
$mentee = get_string('grade_link', 'block_student_gradeviewer', $a);
$body = $data->report;
mtrace('<li><h2>' . $a->user . '</h2>
<ul class="student_list">');
// Get this user's mentors to email, if any at all
$mentors = lookup_mentors($user);
if (!$mentors) {
mtrace('<li>' . get_string('no_mentor', 'block_student_gradeviewer', $a) . '</li></ul></li>');
continue;
}
// If any mentors email them what the teacher said
foreach ($mentors as $mentor) {
$code = 'success';
mtrace('<li>' . get_string('mentor', 'block_student_gradeviewer', $mentor));
$result = email_to_user($mentor, $from, $subject, format_text_email($body . "\n" . $mentee . $grade_link, 1), format_text($body . "<br/>" . $mentee . '<a href="' . $grade_link . '">' . $grade_link . '</a>', 1), $attachment, $attachmentname);
// Email failed
if (!$result) {
$code = 'fail';
}
mtrace(get_string($code, 'block_student_gradeviewer') . '</li>');
}
mtrace('</ul></li>');
}
mtrace(' </ul>');
if ($this->courseid) {
print_continue($CFG->wwwroot . '/course/view.php?id=' . $this->courseid);
}
mtrace('</div>');
}
开发者ID:rrusso,项目名称:EARS,代码行数:57,代码来源:lib.php
示例16: file_rewrite_pluginfile_urls
// Append links to attachments, if any /////////////////////////////
$data->messageWithSigAndAttach .= quickmail::process_attachments($context, $data, $table, $data->id);
// Prepare html content of message
$data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options);
// Same user, alternate email //////////////////////////////////////
if (!empty($data->alternateid)) {
$user = clone $USER;
$user->email = $alternates[$data->alternateid];
} else {
$user = $USER;
}
$data->failuserids = array();
// DWE -> Begin hopefully new way of dealing with messagetext and messagehtml
// TEXT
// This is where we'll need to factor in the preferences of the receiver.
$messagetext = format_text_email($data->messageWithSigAndAttach, $data->format);
// HTML
$messagehtml = format_text($data->messageWithSigAndAttach, $data->format);
if (!empty($data->mailto)) {
foreach (explode(',', $data->mailto) as $userid) {
// Email gets sent here
$success = email_to_user($everyone[$userid], $user, $subject, $messagetext, $messagehtml);
if (!$success) {
$warnings[] = get_string("no_email", 'block_quickmail', $everyone[$userid]);
$data->failuserids[] = $userid;
}
}
}
if (!empty($data->additional_emails)) {
$additional_email_array = preg_split('/[,;]/', $data->additional_emails);
$i = 0;
开发者ID:krishreddy,项目名称:quickmail,代码行数:31,代码来源:email.php
示例17: array
$attendance_exists = $DB->record_exists('local_attendance_attendance', array('sessionid' => $session, 'userid' => $fromform->userid));
$name = empty($sessiondate->comment) ? get_string('noname', 'local_attendance') : $sessiondate->comment;
if (!$attendance_exists) {
$dateData .= date('d/m/Y', $sessiondate->date) . ' - ' . $name . '<br>';
if ($DB->insert_record('local_attendance_attendance', array('sessionid' => $session, 'userid' => $fromform->userid))) {
$row = new html_table_row(array($name, get_string('yes', 'local_attendance'), '<div class="green">' . get_string('emailsent', 'local_attendance') . '</div>'));
$table->data[] = $row;
}
} else {
$row = new html_table_row(array($name, 'No', '<div class="red">' . get_string('alreadypresent', 'local_attendance') . '</div>'));
$table->data[] = $row;
}
}
if ($dateData != NULL) {
$message = '<br><br><br>' . get_string('dear', 'local_attendance') . ',' . '<br>' . get_string('professor', 'local_attendance') . ' ' . $USER->firstname . ' ' . $USER->lastname . ' ' . get_string('changestatus', 'local_attendance') . ' ' . get_string('attendant', 'local_attendance') . ' ' . get_string('onthecourse', 'local_attendance') . ' ' . $courseName->fullname . ', ' . get_string('inthesession', 'local_attendance') . ':<br><br>' . $dataHead . $dateData;
$eventdata->fullmessage = format_text_email($message, FORMAT_HTML);
$send = message_send($eventdata);
}
}
$back = new moodle_url('/local/attendance/viewstudentrecord.php', array('action' => 'view_student_details', 'courseid' => $courseid, 'userid' => $userid));
echo $OUTPUT->single_button($back, get_string('back', 'local_attendance'));
echo html_writer::table($table);
echo $OUTPUT->single_button($back, get_string('back', 'local_attendance'));
} else {
echo '<div class="alert alert-danger">' . get_string('selectsession', 'local_attendance') . '</div>';
$action = 'view_student_details';
}
}
}
if ($action == 'view_student_details') {
$userid
|
请发表评论