Example #1
0
 /**
  * Renders a course enrolment table
  *
  * @param course_enrolment_table $table
  * @return string
  */
 protected function render_course_enrolment_other_users_table(course_enrolment_other_users_table $table)
 {
     $table->initialise_javascript();
     $content = '';
     $searchbutton = $table->get_user_search_button();
     if ($searchbutton) {
         $content .= $this->output->render($searchbutton);
     }
     $content .= html_writer::tag('div', get_string('otheruserdesc', 'enrol'), array('class' => 'otherusersdesc'));
     $content .= $this->output->render($table->get_paging_bar());
     $content .= html_writer::table($table);
     $content .= $this->output->render($table->get_paging_bar());
     $searchbutton = $table->get_user_search_button();
     if ($searchbutton) {
         $content .= $this->output->render($searchbutton);
     }
     return $content;
 }
Example #2
0
require_once "{$CFG->dirroot}/enrol/renderer.php";
require_once "{$CFG->dirroot}/group/lib.php";
$id = required_param('id', PARAM_INT);
// course id
$action = optional_param('action', '', PARAM_ACTION);
$filter = optional_param('ifilter', 0, PARAM_INT);
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
require_login($course);
require_capability('moodle/role:assign', $context);
if ($course->id == SITEID) {
    redirect("{$CFG->wwwroot}/");
}
$PAGE->set_pagelayout('admin');
$manager = new course_enrolment_manager($PAGE, $course, $filter);
$table = new course_enrolment_other_users_table($manager, $PAGE);
$PAGE->set_url('/enrol/otherusers.php', $manager->get_url_params() + $table->get_url_params());
$userdetails = array('picture' => false, 'firstname' => get_string('firstname'), 'lastname' => get_string('lastname'));
$extrafields = get_extra_user_fields($context);
foreach ($extrafields as $field) {
    $userdetails[$field] = get_user_field_name($field);
}
$fields = array('userdetails' => $userdetails, 'lastseen' => get_string('lastaccess'), 'role' => get_string('roles', 'role'));
// Remove hidden fields if the user has no access
if (!has_capability('moodle/course:viewhiddenuserfields', $context)) {
    $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
    if (isset($hiddenfields['lastaccess'])) {
        unset($fields['lastseen']);
    }
}
$table->set_fields($fields, $OUTPUT);
Example #3
0
require_once "{$CFG->dirroot}/group/lib.php";
$id = required_param('id', PARAM_INT);
// course id
$action = optional_param('action', '', PARAM_ACTION);
$filter = optional_param('ifilter', 0, PARAM_INT);
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
require_login($course);
require_capability('moodle/role:assign', $context);
if ($course->id == SITEID) {
    redirect("{$CFG->wwwroot}/");
}
$PAGE->set_url('/enrol/otherusers.php', array('id' => $course->id));
$PAGE->set_pagelayout('admin');
$manager = new course_enrolment_manager($course, $filter);
$table = new course_enrolment_other_users_table($manager, $PAGE->url);
$pageurl = new moodle_url($PAGE->url, $manager->get_url_params() + $table->get_url_params());
/***
 * Actions will go here
 */
/*$fields = array(
    'userdetails' => array (
        'picture' => false,
        'firstname' => get_string('firstname'),
        'lastname' => get_string('lastname'),
        'email' => get_string('email')
    ),
    'lastseen' => get_string('lastaccess'),
    'role' => array(
        'roles' => get_string('roles', 'role'),
        'context' => get_string('context')