本文整理汇总了PHP中message_send函数的典型用法代码示例。如果您正苦于以下问题:PHP message_send函数的具体用法?PHP message_send怎么用?PHP message_send使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message_send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: portfolio_picasa_admin_upgrade_notification
function portfolio_picasa_admin_upgrade_notification() {
$admins = get_admins();
if (empty($admins)) {
return;
}
$mainadmin = reset($admins);
$a = new stdClass;
$a->docsurl = get_docs_url('Google_OAuth_2.0_setup');
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = $mainadmin;
$message->userto = $admin;
$message->smallmessage = get_string('oauth2upgrade_message_small', 'portfolio_picasa');
$message->subject = get_string('oauth2upgrade_message_subject', 'portfolio_picasa');
$message->fullmessage = get_string('oauth2upgrade_message_content', 'portfolio_picasa', $a);
$message->fullmessagehtml = get_string('oauth2upgrade_message_content', 'portfolio_picasa', $a);
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例2: execute
public function execute()
{
global $USER;
// Check to make sure external communications hasn't been disabled
$extcom = !!get_config('mod_hvp', 'external_communication');
$extcomnotify = !!get_config('mod_hvp', 'external_communication_notify');
if ($extcom || !$extcomnotify) {
$core = \mod_hvp\framework::instance();
$core->fetchLibrariesMetadata(!$extcom);
set_config('external_communication_notify', $extcom ? false : time(), 'mod_hvp');
// Notify admin if there are updates available!
$update_available = \get_config('mod_hvp', 'update_available');
$current_update = \get_config('mod_hvp', 'current_update');
$admin_notified = \get_config('mod_hvp', 'admin_notified');
if ($admin_notified !== $update_available && $update_available !== false && $current_update !== false && $current_update < $update_available) {
// New update is available
// Send message
$updatesurl = new \moodle_url('/mod/hvp/library_list.php');
$message = new \stdClass();
$message->component = 'mod_hvp';
$message->name = 'updates';
$message->userfrom = $USER;
$message->userto = get_admin();
$message->subject = get_string('updatesavailabletitle', 'mod_hvp');
$message->fullmessage = get_string('updatesavailablemsgpt1', 'mod_hvp') . ' ' . get_string('updatesavailablemsgpt2', 'mod_hvp') . "\n\n" . get_string('updatesavailablemsgpt3', 'mod_hvp', date('Y-m-d', $update_available)) . "\n" . get_string('updatesavailablemsgpt4', 'mod_hvp', date('Y-m-d', $current_update)) . "\n\n" . $updatesurl;
$message->fullmessageformat = FORMAT_PLAIN;
$message->fullmessagehtml = '<p>' . get_string('updatesavailablemsgpt1', 'mod_hvp') . '<br/>' . get_string('updatesavailablemsgpt2', 'mod_hvp') . '</p>' . '<p>' . get_string('updatesavailablemsgpt3', 'mod_hvp', '<b>' . date('Y-m-d', $update_available) . '</b>') . '<br/>' . get_string('updatesavailablemsgpt4', 'mod_hvp', '<b>' . date('Y-m-d', $current_update) . '</b>') . '</p>' . '<a href="' . $updatesurl . '" target="_blank">' . $updatesurl . '</a>';
$message->smallmessage = '';
$message->notification = 1;
message_send($message);
// Keep track of which version we've notfied about
\set_config('admin_notified', $update_available, 'mod_hvp');
}
}
}
示例3: execute
/**
* Send out messages.
*/
public function execute()
{
foreach ($this->get_custom_data() as $data) {
$eventobj = $data->event;
$subscriptionids = $data->subscriptionids;
foreach ($subscriptionids as $id) {
if ($message = $this->generate_message($id, $eventobj)) {
message_send($message);
}
}
}
}
示例4: execute
/**
* Send out messages.
*/
public function execute()
{
foreach ($this->get_custom_data() as $data) {
$eventobj = $data->event;
$subscriptionids = $data->subscriptionids;
foreach ($subscriptionids as $id) {
if ($message = $this->generate_message($id, $eventobj)) {
mtrace("Sending message to the user with id " . $message->userto->id . " for the subscription with id {$id}...");
message_send($message);
mtrace("Sent.");
}
}
}
}
示例5: send_message
/**
* Send non-submitters message to students.
*
* @param string $message
* @return void
*/
public function send_message($userid, $subject, $message)
{
$eventdata = new stdClass();
$eventdata->component = 'mod_turnitintooltwo';
//your component name
$eventdata->name = 'nonsubmitters';
//this is the message name from messages.php
$eventdata->userfrom = get_admin();
$eventdata->userto = $userid;
$eventdata->subject = $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->notification = 1;
//this is only set to 0 for personal messages between users
message_send($eventdata);
}
示例6: clam_message_admins
/**
* Emails admins about a clam outcome
*
* @param string $notice The body of the email to be sent.
*/
function clam_message_admins($notice)
{
$site = get_site();
$subject = get_string('clamemailsubject', 'moodle', format_string($site->fullname));
$admins = get_admins();
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->component = 'moodle';
$eventdata->name = 'errors';
$eventdata->userfrom = get_admin();
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $notice;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
}
示例7: send_message
/**
* Send digital receipt to submitter
*
* @param string $message
* @return void
*/
public function send_message($userid, $message)
{
global $CFG;
$subject = get_string('digital_receipt_subject', 'turnitintooltwo');
$eventdata = new stdClass();
$eventdata->component = 'mod_turnitintooltwo';
//your component name
$eventdata->name = 'submission';
//this is the message name from messages.php
$eventdata->userfrom = \core_user::get_noreply_user();
$eventdata->userto = $userid;
$eventdata->subject = $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->notification = 1;
//this is only set to 0 for personal messages between users
message_send($eventdata);
}
示例8: repository_alfresco_admin_security_key_notice
/**
* Send a message to the admin in regard with the APIv1 migration.
*
* @return void
*/
function repository_alfresco_admin_security_key_notice()
{
$admins = get_admins();
if (empty($admins)) {
return;
}
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = get_admin();
$message->userto = $admin;
$message->smallmessage = get_string('security_key_notice_message_small', 'repository_alfresco');
$message->subject = get_string('security_key_notice_message_subject', 'repository_alfresco');
$message->fullmessage = get_string('security_key_notice_message_content', 'repository_alfresco');
$message->fullmessagehtml = get_string('security_key_notice_message_content', 'repository_alfresco');
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例9: message_paypal_error_to_admin
/**
* Alerts site admin of potential problems.
*
* @param string $subject email subject
* @param stdClass $data PayPal IPN data
*/
public static function message_paypal_error_to_admin($subject, $data)
{
$admin = get_admin();
$site = get_site();
$message = "{$site->fullname}: Transaction failed.\n\n{$subject}\n\n";
foreach ($data as $key => $value) {
$message .= "{$key} => {$value}\n";
}
$eventdata = new \stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'enrol_paypal';
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = "PAYPAL ERROR: " . $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
示例10: send_instructor_message
/**
* Send instructor message to instructors on course.
*
* @param array $instructors
* @param string $message
* @return void
*/
public function send_instructor_message($instructors, $message)
{
$subject = get_string('receipt_instructor_copy_subject', 'turnitintooltwo');
$eventdata = new stdClass();
$eventdata->component = 'mod_turnitintooltwo';
//your component name
$eventdata->name = 'submission';
//this is the message name from messages.php
$eventdata->userfrom = \core_user::get_noreply_user();
$eventdata->subject = $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->notification = 1;
//this is only set to 0 for personal messages between users
foreach ($instructors as $instructor) {
$eventdata->userto = $instructor->id;
message_send($eventdata);
}
unset($instructor);
}
示例11: repository_googledocs_admin_upgrade_notification
function repository_googledocs_admin_upgrade_notification() {
$admins = get_admins();
if (empty($admins)) {
return;
}
$mainadmin = reset($admins);
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = $mainadmin;
$message->userto = $admin;
$message->smallmessage = get_string('oauth2upgrade_message_small', 'repository_googledocs');
$message->subject = get_string('oauth2upgrade_message_subject', 'repository_googledocs');
$message->fullmessage = get_string('oauth2upgrade_message_content', 'repository_googledocs');
$message->fullmessagehtml = get_string('oauth2upgrade_message_content', 'repository_googledocs');
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例12: repository_boxnet_admin_upgrade_notification
/**
* Send a message to the admin in regard with the APIv1 migration.
*
* @return void
*/
function repository_boxnet_admin_upgrade_notification()
{
$admins = get_admins();
if (empty($admins)) {
return;
}
$a = new stdClass();
$a->docsurl = get_docs_url('Box.net_APIv1_migration');
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = get_admin();
$message->userto = $admin;
$message->smallmessage = get_string('apiv1migration_message_small', 'repository_boxnet');
$message->subject = get_string('apiv1migration_message_subject', 'repository_boxnet');
$message->fullmessage = get_string('apiv1migration_message_content', 'repository_boxnet', $a);
$message->fullmessagehtml = get_string('apiv1migration_message_content', 'repository_boxnet', $a);
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例13: mod_assignment_pending_upgrades_notification
/**
* Inform admins about assignments that still need upgrading.
*/
function mod_assignment_pending_upgrades_notification($count)
{
$admins = get_admins();
if (empty($admins)) {
return;
}
$a = new stdClass();
$a->count = $count;
$a->docsurl = get_docs_url('Assignment_upgrade_tool');
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = \core_user::get_noreply_user();
$message->userto = $admin;
$message->smallmessage = get_string('pendingupgrades_message_small', 'mod_assignment');
$message->subject = get_string('pendingupgrades_message_subject', 'mod_assignment');
$message->fullmessage = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
$message->fullmessagehtml = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例14: test_message_attachment_send
public function test_message_attachment_send()
{
global $CFG;
$this->preventResetByRollback();
$this->resetAfterTest();
// Set config setting to allow attachments.
$CFG->allowattachments = true;
unset_config('noemailever');
$user = $this->getDataGenerator()->create_user();
$context = context_user::instance($user->id);
// Create a test file.
$fs = get_file_storage();
$filerecord = array('contextid' => $context->id, 'component' => 'core', 'filearea' => 'unittest', 'itemid' => 99999, 'filepath' => '/', 'filename' => 'emailtest.txt');
$file = $fs->create_file_from_string($filerecord, 'Test content');
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = get_admin();
$message->userto = $user;
$message->subject = 'message subject 1';
$message->fullmessage = 'message body';
$message->fullmessageformat = FORMAT_MARKDOWN;
$message->fullmessagehtml = '<p>message body</p>';
$message->smallmessage = 'small message';
$message->attachment = $file;
$message->attachname = 'emailtest.txt';
$message->notification = 0;
// Make sure we are redirecting emails.
$sink = $this->redirectEmails();
$this->assertTrue(phpunit_util::is_redirecting_phpmailer());
message_send($message);
// Get the email that we just sent.
$emails = $sink->get_messages();
$email = reset($emails);
$this->assertTrue(strpos($email->body, 'Content-Disposition: attachment;') !== false);
$this->assertTrue(strpos($email->body, 'emailtest.txt') !== false);
// Check if the stored file still exists after remove the temporary attachment.
$storedfileexists = $fs->file_exists($filerecord['contextid'], $filerecord['component'], $filerecord['filearea'], $filerecord['itemid'], $filerecord['filepath'], $filerecord['filename']);
$this->assertTrue($storedfileexists);
}
示例15: message_post_message
/**
* Send a message from one user to another. Will be delivered according to the message recipients messaging preferences
* @param object $userfrom the message sender
* @param object $userto the message recipient
* @param string $message the message
* @param int $format message format such as FORMAT_PLAIN or FORMAT_HTML
* @return int|false the ID of the new message or false
*/
function message_post_message($userfrom, $userto, $message, $format) {
global $SITE, $CFG, $USER;
$eventdata = new stdClass();
$eventdata->component = 'moodle';
$eventdata->name = 'instantmessage';
$eventdata->userfrom = $userfrom;
$eventdata->userto = $userto;
//using string manager directly so that strings in the message will be in the message recipients language rather than the senders
$eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang);
if ($format == FORMAT_HTML) {
$eventdata->fullmessage = '';
$eventdata->fullmessagehtml = $message;
} else {
$eventdata->fullmessage = $message;
$eventdata->fullmessagehtml = '';
}
$eventdata->fullmessageformat = $format;
$eventdata->smallmessage = $message;//store the message unfiltered. Clean up on output.
$s = new stdClass();
$s->sitename = $SITE->shortname;
$s->url = $CFG->wwwroot.'/message/index.php?user='.$userto->id.'&id='.$userfrom->id;
$emailtagline = get_string_manager()->get_string('emailtagline', 'message', $s, $userto->lang);
if (!empty($eventdata->fullmessage)) {
$eventdata->fullmessage .= "\n\n---------------------------------------------------------------------\n".$emailtagline;
}
if (!empty($eventdata->fullmessagehtml)) {
$eventdata->fullmessagehtml .= "<br /><br />---------------------------------------------------------------------<br />".$emailtagline;
}
$eventdata->timecreated = time();
return message_send($eventdata);
}