Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/otherusers.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00026 require('../config.php');
00027 require_once("$CFG->dirroot/enrol/locallib.php");
00028 require_once("$CFG->dirroot/enrol/renderer.php");
00029 require_once("$CFG->dirroot/group/lib.php");
00030 
00031 $id      = required_param('id', PARAM_INT); // course id
00032 $action  = optional_param('action', '', PARAM_ACTION);
00033 $filter  = optional_param('ifilter', 0, PARAM_INT);
00034 
00035 $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
00036 $context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
00037 
00038 require_login($course);
00039 require_capability('moodle/role:assign', $context);
00040 
00041 if ($course->id == SITEID) {
00042     redirect("$CFG->wwwroot/");
00043 }
00044 
00045 $PAGE->set_pagelayout('admin');
00046 
00047 $manager = new course_enrolment_manager($PAGE, $course, $filter);
00048 $table = new course_enrolment_other_users_table($manager, $PAGE);
00049 $PAGE->set_url('/enrol/otherusers.php', $manager->get_url_params()+$table->get_url_params());
00050 
00051 /***
00052  * Actions will go here
00053  */
00054 
00055 /*$fields = array(
00056     'userdetails' => array (
00057         'picture' => false,
00058         'firstname' => get_string('firstname'),
00059         'lastname' => get_string('lastname'),
00060         'email' => get_string('email')
00061     ),
00062     'lastseen' => get_string('lastaccess'),
00063     'role' => array(
00064         'roles' => get_string('roles', 'role'),
00065         'context' => get_string('context')
00066     )
00067 );*/
00068 $fields = array(
00069     'userdetails' => array (
00070         'picture' => false,
00071         'firstname' => get_string('firstname'),
00072         'lastname' => get_string('lastname'),
00073         'email' => get_string('email')
00074     ),
00075     'lastseen' => get_string('lastaccess'),
00076     'role' => get_string('roles', 'role')
00077 );
00078 $table->set_fields($fields, $OUTPUT);
00079 
00080 //$users = $manager->get_other_users($table->sort, $table->sortdirection, $table->page, $table->perpage);
00081 
00082 $renderer = $PAGE->get_renderer('core_enrol');
00083 $canassign = has_capability('moodle/role:assign', $manager->get_context());
00084 $users = $manager->get_other_users_for_display($renderer, $PAGE->url, $table->sort, $table->sortdirection, $table->page, $table->perpage);
00085 $assignableroles = $manager->get_assignable_roles(true);
00086 foreach ($users as $userid=>&$user) {
00087     $user['picture'] = $OUTPUT->render($user['picture']);
00088     $user['role'] = $renderer->user_roles_and_actions($userid, $user['roles'], $assignableroles, $canassign, $PAGE->url);
00089 }
00090 
00091 $table->set_total_users($manager->get_total_other_users());
00092 $table->set_users($users);
00093 
00094 $PAGE->set_title($course->fullname.': '.get_string('totalotherusers', 'enrol', $manager->get_total_other_users()));
00095 $PAGE->set_heading($PAGE->title);
00096 
00097 echo $OUTPUT->header();
00098 echo $renderer->render($table);
00099 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations