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


PHP EmailTemplate::send_to_all_users_in_department方法代码示例

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


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

示例1: test

function test()
{
    echo "<hr /><b>Fake user object</b>";
    $user = (object) array('firstname' => 'User', 'lastname' => 'Test', 'email' => 'testuser@somewhere.com', 'username' => 'testuser', 'newpassword' => 'somenewpassword');
    $sender = (object) array('firstname' => 'Test', 'Lastname' => 'User');
    echo EmailTemplate::send('user_create', array('user' => $user, 'course' => 2, 'sender' => $sender));
    echo EmailTemplate::send('user_added_to_course', array('course' => 2), array(array('user' => 3), array('user' => 56), array('user' => $user)));
    echo "<hr /><b>Email template from database</b>";
    echo EmailTemplate::send('user_added_to_course', array('user' => 3, 'course' => 2));
    echo "<hr /><b>Email to current user about current course</b>";
    echo EmailTemplate::send('user_added_to_course');
    echo "<hr/><b>Email all users in a department</b>";
    echo EmailTemplate::send_to_all_users_in_department(3, 'user_added_to_course', array('course' => 2));
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:14,代码来源:test.php

示例2: moodle_url

// Set the url.
$linkurl = new moodle_url('/local/email/template_edit_form.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'email', 'local', 'send_emails');
$blockpage->setup();
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
// Get the form data.
// Set up the form.
$mform = new template_send_form($PAGE->url, $context, $companyid, $templateid, $templaterecord);
$mform->set_data($templaterecord);
if ($mform->is_cancelled()) {
    redirect($templatelist);
} else {
    if ($data = $mform->get_data()) {
        $data->userid = $USER->id;
        foreach ($data->selectedcourses as $course) {
            $depts = company::get_departments_by_course($course->id);
            $sql = "SELECT\n                    cr.*,\n                    ccr.startdatetime,\n                    ccr.enddatetime,\n                    ccr.intro as summary\n                FROM {courseclassroom} ccr\n                    INNER JOIN {classroom} cr ON ccr.classroomid = cr.id\n                WHERE ccr.course = :course\n                ORDER BY ccr.startdatetime > " . time() . ", ccr.startdatetime";
            $classroom = $DB->get_record_sql($sql, array('course' => $course->id), 0, 1);
            foreach ($depts as $departmentid) {
                EmailTemplate::send_to_all_users_in_department($departmentid, $templaterecord->name, array('course' => $course->id, 'classroom' => $classroom));
            }
        }
        redirect($templatelist);
    }
}
$blockpage->display_header();
$mform->display();
echo $OUTPUT->footer();
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:template_send_form.php

示例3: get_string

 $PAGE->set_heading($SITE->fullname);
 // Are we sending out emails?
 if (!empty($publish)) {
     if (has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
         $userhierarchylevel = $parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $departmentid = $userhierarchylevel;
     echo $OUTPUT->header();
     echo "<h2>" . get_string('sendingemails', 'trainingevent') . "</h2>";
     $course = $DB->get_record('course', array('id' => $event->course));
     $course->url = new moodle_url('course/view.php', array('id' => $course->id));
     $location->time = date('jS \\of F Y \\a\\t h:i', $event->startdatetime);
     EmailTemplate::send_to_all_users_in_department($departmentid, 'advertise_classroom_based_course', array('course' => $course, 'classroom' => $location, 'event' => $event));
     redirect("{$CFG->wwwroot}/mod/trainingevent/view.php?id={$id}", get_string('emailssent', 'trainingevent'));
     die;
 }
 // Get the current number booked on it.
 $numattending = $DB->count_records('trainingevent_users', array('trainingeventid' => $event->id));
 $eventtable = "<h2>{$event->name}</h2>";
 if (!empty($messagestring)) {
     $eventtable .= "<p>{$messagestring}</p>";
 }
 $eventtable .= "<table><tr>";
 if (has_capability('mod/trainingevent:invite', $context)) {
     $eventtable .= "<td>" . $OUTPUT->single_button("{$CFG->wwwroot}/mod/trainingevent/view.php?id={$id}&publish=1", get_string('publish', 'trainingevent')) . "</td>";
 }
 if (has_capability('mod/trainingevent:viewattendees', $context)) {
     $eventtable .= "<td>" . $OUTPUT->single_button("{$CFG->wwwroot}/mod/trainingevent/view.php?id={$id}&view=1", get_string('viewattendees', 'trainingevent')) . "</td>";
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:view.php


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