<form action="manageActionBlock.php" method="post">
        <div >
            <p style="font-size:12px;">Select the users to whom you want to send an email:</p>
            <div class="datatable" style="overflow-y:scroll;height:350px;padding:10px 40px;background-color:#F2F3F9;width:340px;">
                <table style="border-spacing:0pt">
                <thead>
                    <tr>
                    <th class="cellAlign1" scope="col">User Name</th>
                    <th class="cellAlign1" scope="col">Email</th>
                    <th class="cellAlign1" scope="col">Selected</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
for ($i = 0; $i < count($users_key); $i++) {
    $roleInCourse = get_user_roles_in_context($users[$users_key[$i]]->id, $context);
    if (!empty($roleInCourse)) {
        //A role is assigned to this user in the course context, this user has to be displayed
        ?>
                        <tr>
                            <td class="cellAlign1" style="width:150px" >
                                <span><?php 
        echo $users[$users_key[$i]]->firstname . " " . $users[$users_key[$i]]->lastname;
        ?>
</span>
                                </td>
                            <td class="cellAlign1"><span><?php 
        echo $users[$users_key[$i]]->email;
        ?>
</span></td>
                            <td class="cellAlign2">
예제 #2
0
function voiceemail_getEnrolledUsers($courseId, $typeRecipients)
{
    $instuctors = "";
    $students = "";
    $context = get_context_instance(CONTEXT_COURSE, $courseId);
    $allusers = get_users_by_capability($context, 'moodle/course:view');
    //$allusers also contain the users which have this capabilities at the system level
    $users_key = array_keys($allusers);
    for ($i = 0; $i < count($users_key); $i++) {
        $roleInCourse = get_user_roles_in_context($allusers[$users_key[$i]]->id, $context);
        if (!empty($roleInCourse)) {
            //A role is assigned to this user in the course context, this user has to be displayed
            if (has_capability('mod/voiceemail:presenter', $context, $allusers[$users_key[$i]]->id)) {
                $instuctors .= $allusers[$users_key[$i]]->email . ";";
            } else {
                $students .= $allusers[$users_key[$i]]->email . ";";
            }
        }
    }
    switch ($typeRecipients) {
        case "students":
            return substr($students, 0, strlen($students) - 1);
            break;
        case "instructors":
            return substr($instuctors, 0, strlen($instuctors) - 1);
            break;
        case "all":
            return substr($instuctors . $students, 0, strlen($instuctors . $students) - 1);
            break;
    }
    return null;
}
예제 #3
0
파일: view.php 프로젝트: r007/PMoodle
            $courselisting .= "...";
            break;
        }
    }
    print_row(get_string('courses') . ':', rtrim($courselisting, ', '));
}
if (!isset($hiddenfields['lastaccess'])) {
    if ($user->lastaccess) {
        $datestring = userdate($user->lastaccess) . "&nbsp; (" . format_time(time() - $user->lastaccess) . ")";
    } else {
        $datestring = get_string("never");
    }
    print_row(get_string("lastaccess") . ":", $datestring);
}
/// printing roles
if ($rolestring = get_user_roles_in_context($id, $coursecontext)) {
    print_row(get_string('roles') . ':', format_string($rolestring, false));
}
/// Printing groups
$isseparategroups = ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce and !has_capability('moodle/site:accessallgroups', $coursecontext));
if (!$isseparategroups) {
    if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
        $groupstr = '';
        foreach ($usergroups as $group) {
            $groupstr .= ' <a href="' . $CFG->wwwroot . '/user/index.php?id=' . $course->id . '&amp;group=' . $group->id . '">' . format_string($group->name) . '</a>,';
        }
        print_row(get_string("group") . ":", rtrim($groupstr, ', '));
    }
}
/// End of printing groups
/// Printing Interests
/**
* a raster for xls printing of a report structure header
* with all the relevant data about a user.
*
*/
function training_reports_print_header_xls(&$worksheet, $userid, $courseid, $data, $xls_formats)
{
    global $CFG;
    $user = get_record('user', 'id', $userid);
    $course = get_record('course', 'id', $courseid);
    $row = 0;
    $worksheet->set_row(0, 40, $xls_formats['t']);
    $worksheet->write_string($row, 0, get_string('sessionreports', 'report_trainingsessions'), $xls_formats['t']);
    $worksheet->merge_cells($row, 0, 0, 12);
    $row++;
    $worksheet->write_string($row, 0, get_string('user') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, fullname($user));
    $row++;
    $worksheet->write_string($row, 0, get_string('email') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, $user->email);
    $row++;
    $worksheet->write_string($row, 0, get_string('city') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, $user->city);
    $row++;
    $worksheet->write_string($row, 0, get_string('institution') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, $user->institution);
    $row++;
    $worksheet->write_string($row, 0, get_string('course', 'report_trainingsessions') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, $course->fullname);
    $row++;
    $worksheet->write_string($row, 0, get_string('from') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, userdate($data->from));
    $row++;
    $worksheet->write_string($row, 0, get_string('to') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, userdate(time()));
    $row++;
    $usergroups = groups_get_all_groups($courseid, $userid, 0, 'g.id, g.name');
    // print group status
    $worksheet->write_string($row, 0, get_string('groups') . ' :', $xls_formats['p']);
    $str = '';
    if (!empty($usergroups)) {
        foreach ($usergroups as $group) {
            $str = $group->name;
            if ($group->id == get_current_group($courseid)) {
                $str = "[{$str}]";
            }
            $groupnames[] = $str;
        }
        $str = implode(', ', $groupnames);
    }
    $worksheet->write_string($row, 1, $str);
    $row++;
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
    $worksheet->write_string($row, 0, get_string('roles') . ' :', $xls_formats['p']);
    $worksheet->write_string($row, 1, strip_tags(get_user_roles_in_context($userid, $context)));
    $row++;
    // print completion bar
    $completed = $data->done / $data->items;
    $remaining = 1 - $completed;
    $completedpc = ceil($completed * 100);
    $remainingpc = 100 - $completedpc;
    $worksheet->write_string($row, 0, get_string('done', 'report_trainingsessions'), $xls_formats['p']);
    $worksheet->write_string($row, 1, $data->done . ' ' . get_string('over', 'report_trainingsessions') . ' ' . $data->items . ' (' . $completedpc . ' %)');
    $row++;
    $worksheet->write_string($row, 0, get_string('elapsed', 'report_trainingsessions') . ' :', $xls_formats['p']);
    $worksheet->write_number($row, 1, training_reports_format_time($data->elapsed, 'xls'), $xls_formats['zt']);
    $row++;
    $worksheet->write_string($row, 0, get_string('hits', 'report_trainingsessions') . ' :', $xls_formats['p']);
    $worksheet->write_number($row, 1, $data->events);
    return $row;
}