dirroot.'/enrol/renderer.php'); require_once($CFG->dirroot.'/enrol/locallib.php'); require_once($CFG->dirroot.'/lib/outputcomponents.php'); require_once ('lib.php'); $site = get_site (); $systemcontext = context_system::instance(); $id = required_param ( 'id', PARAM_INT ); // course id $course = $DB->get_record ( 'course', array ('id' => $id ), '*', MUST_EXIST ); $context = context_course::instance($course->id, MUST_EXIST); require_login ( $course ); require_capability ( 'moodle/course:enrolreview', $context ); $PAGE->set_url ( '/enrol/apply.php', array ('id' => $course->id ) ); //$PAGE->set_context($systemcontext); $PAGE->set_pagelayout ( 'admin' ); $PAGE->set_heading ( $course->fullname ); $PAGE->navbar->add ( get_string ( 'confirmusers', 'enrol_apply' ) ); $PAGE->set_title ( "$site->shortname: " . get_string ( 'confirmusers', 'enrol_apply' ) ); if (isset ( $_POST ['enrolid'] )) { if ($_POST ['enrolid']) { if ($_POST ['type'] == 'confirm') { confirmEnrolment ( $_POST ['enrolid'] ); } elseif ($_POST ['type'] == 'cancel') { cancelEnrolment ( $_POST ['enrolid'] ); } redirect ( "$CFG->wwwroot/enrol/apply/apply.php?id=" . $id . "&enrolid=" . $_GET ['enrolid'] ); } } $enrols = getAllEnrolment ($id); echo $OUTPUT->header (); echo $OUTPUT->heading ( get_string ( 'confirmusers', 'enrol_apply' ) ); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ( $enrols as $enrol ) { $picture = get_user_picture($enrol->userid); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
 ' . get_string ( 'coursename', 'enrol_apply' ) . ' ' . get_string ( 'applyuser', 'enrol_apply' ) . '' . get_string ( 'applyusermail', 'enrol_apply' ) . '' . get_string ( 'applydate', 'enrol_apply' ) . '
' . format_string($enrol->course) . '' . $OUTPUT->render($picture) . ''.$enrol->firstname . ' ' . $enrol->lastname.'' . $enrol->email . '' . date ( "Y-m-d", $enrol->timecreated ) . '
'; echo '

  

'; echo '
'; echo ''; echo $OUTPUT->footer (); function get_user_picture($userid){ global $DB; $extrafields[] = 'lastaccess'; $ufields = user_picture::fields('u', $extrafields); $sql = "SELECT DISTINCT $ufields FROM {user} u where u.id=$userid"; $user = $DB->get_record_sql($sql); return new user_picture($user); }