2009-09-30 06:32:25 +00:00
|
|
|
<?php
|
2008-11-13 04:07:01 +00:00
|
|
|
|
2010-03-07 09:28:54 +00:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
2008-11-13 04:07:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Lets you assign roles to users in a particular context.
|
|
|
|
*
|
2010-09-06 11:17:43 +00:00
|
|
|
* @package core
|
2010-03-07 09:28:54 +00:00
|
|
|
* @subpackage role
|
|
|
|
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2006-08-08 05:13:06 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
require_once(dirname(__FILE__) . '/../../config.php');
|
|
|
|
require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php');
|
2006-08-08 05:13:06 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
define("MAX_USERS_TO_LIST_PER_ROLE", 10);
|
2006-08-08 05:13:06 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$contextid = required_param('contextid',PARAM_INT);
|
|
|
|
$roleid = optional_param('roleid', 0, PARAM_INT);
|
2007-03-05 11:27:01 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
list($context, $course, $cm) = get_context_info_array($contextid);
|
2010-03-07 09:28:54 +00:00
|
|
|
|
2010-04-21 02:43:02 +00:00
|
|
|
$url = new moodle_url('/admin/roles/assign.php', array('contextid' => $contextid));
|
2006-09-16 12:41:47 +00:00
|
|
|
|
2010-07-13 20:54:16 +00:00
|
|
|
if ($course) {
|
|
|
|
$isfrontpage = ($course->id == SITEID);
|
|
|
|
} else {
|
|
|
|
$isfrontpage = false;
|
2010-03-31 08:33:17 +00:00
|
|
|
if ($context->contextlevel == CONTEXT_USER) {
|
2010-04-21 02:43:02 +00:00
|
|
|
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
|
|
|
|
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
|
|
|
|
$url->param('courseid', $course->id);
|
|
|
|
$url->param('userid', $user->id);
|
2010-07-13 20:54:16 +00:00
|
|
|
} else {
|
2010-03-31 08:33:17 +00:00
|
|
|
$course = $SITE;
|
2007-05-22 02:08:22 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 02:43:02 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// security
|
|
|
|
require_login($course, false, $cm);
|
|
|
|
require_capability('moodle/role:assign', $context);
|
2010-04-21 02:43:02 +00:00
|
|
|
$PAGE->set_url($url);
|
2010-03-31 08:33:17 +00:00
|
|
|
$PAGE->set_context($context);
|
|
|
|
|
|
|
|
$contextname = print_context_name($context);
|
2010-07-13 20:54:16 +00:00
|
|
|
$courseid = $course->id;
|
2010-03-31 08:33:17 +00:00
|
|
|
|
|
|
|
// These are needed early because of tabs.php
|
|
|
|
list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true);
|
|
|
|
$overridableroles = get_overridable_roles($context, ROLENAME_BOTH);
|
|
|
|
|
|
|
|
// Make sure this user can assign this role
|
|
|
|
if ($roleid && !isset($assignableroles[$roleid])) {
|
|
|
|
$a = new stdClass;
|
|
|
|
$a->roleid = $roleid;
|
|
|
|
$a->context = $contextname;
|
|
|
|
print_error('cannotassignrolehere', '', get_context_url($context), $a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Work out an appropriate page title.
|
|
|
|
if ($roleid) {
|
|
|
|
$a = new stdClass;
|
|
|
|
$a->role = $assignableroles[$roleid];
|
|
|
|
$a->context = $contextname;
|
|
|
|
$title = get_string('assignrolenameincontext', 'role', $a);
|
|
|
|
} else {
|
|
|
|
if ($isfrontpage) {
|
|
|
|
$title = get_string('frontpageroles', 'admin');
|
2008-11-03 06:06:08 +00:00
|
|
|
} else {
|
2010-03-31 08:33:17 +00:00
|
|
|
$title = get_string('assignrolesin', 'role', $contextname);
|
2008-11-03 06:06:08 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Process any incoming role assignments before printing the header.
|
|
|
|
if ($roleid) {
|
|
|
|
|
|
|
|
// Create the user selector objects.
|
|
|
|
$options = array('context' => $context, 'roleid' => $roleid);
|
|
|
|
|
|
|
|
$potentialuserselector = roles_get_potential_user_selector($context, 'addselect', $options);
|
|
|
|
$currentuserselector = new existing_role_holders('removeselect', $options);
|
|
|
|
|
|
|
|
// Process incoming role assignments
|
|
|
|
$errors = array();
|
|
|
|
if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
|
|
|
|
$userstoassign = $potentialuserselector->get_selected_users();
|
|
|
|
if (!empty($userstoassign)) {
|
|
|
|
|
|
|
|
foreach ($userstoassign as $adduser) {
|
|
|
|
$allow = true;
|
2006-09-15 14:32:35 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
if ($allow) {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
role_assign($roleid, $adduser->id, $context->id);
|
2007-09-19 03:31:22 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
2007-09-19 03:48:44 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$potentialuserselector->invalidate_selected_users();
|
|
|
|
$currentuserselector->invalidate_selected_users();
|
2007-09-21 07:52:52 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$rolename = $assignableroles[$roleid];
|
|
|
|
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
|
|
|
// Counts have changed, so reload.
|
|
|
|
list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true);
|
2007-09-19 03:31:22 +00:00
|
|
|
}
|
2008-11-04 07:26:32 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Process incoming role unassignments
|
|
|
|
if (optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) {
|
|
|
|
$userstounassign = $currentuserselector->get_selected_users();
|
|
|
|
if (!empty($userstounassign)) {
|
|
|
|
|
|
|
|
foreach ($userstounassign as $removeuser) {
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
//unassign only roles that are added manually, no messing with other components!!!
|
|
|
|
role_unassign($roleid, $removeuser->id, $context->id, '');
|
2008-11-04 07:26:32 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$potentialuserselector->invalidate_selected_users();
|
|
|
|
$currentuserselector->invalidate_selected_users();
|
2008-11-04 07:26:32 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$rolename = $assignableroles[$roleid];
|
|
|
|
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
|
|
|
// Counts have changed, so reload.
|
|
|
|
list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true);
|
|
|
|
}
|
2008-11-04 07:26:32 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 02:43:02 +00:00
|
|
|
$PAGE->set_pagelayout('admin');
|
|
|
|
$PAGE->set_title($title);
|
|
|
|
|
|
|
|
switch ($context->contextlevel) {
|
|
|
|
case CONTEXT_SYSTEM:
|
|
|
|
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
|
|
|
break;
|
|
|
|
case CONTEXT_USER:
|
2010-07-13 20:54:16 +00:00
|
|
|
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
|
|
|
$PAGE->set_heading($fullname);
|
2010-04-21 02:43:02 +00:00
|
|
|
$showroles = 1;
|
|
|
|
break;
|
|
|
|
case CONTEXT_COURSECAT:
|
|
|
|
$PAGE->set_heading("$SITE->fullname: ".get_string("categories"));
|
|
|
|
break;
|
|
|
|
case CONTEXT_COURSE:
|
|
|
|
if ($isfrontpage) {
|
|
|
|
admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
|
|
|
|
} else {
|
|
|
|
$PAGE->set_heading($course->fullname);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONTEXT_MODULE:
|
|
|
|
$PAGE->set_heading(print_context_name($context, false));
|
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
break;
|
|
|
|
case CONTEXT_BLOCK:
|
|
|
|
$PAGE->set_heading($PAGE->course->fullname);
|
|
|
|
break;
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 02:43:02 +00:00
|
|
|
echo $OUTPUT->header();
|
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print heading.
|
2010-04-21 02:43:02 +00:00
|
|
|
echo $OUTPUT->heading_with_help($title, 'assignroles', 'role');
|
2010-03-31 08:33:17 +00:00
|
|
|
|
|
|
|
if ($roleid) {
|
|
|
|
// Show UI for assigning a particular role to users.
|
|
|
|
// Print a warning if we are assigning system roles.
|
|
|
|
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
|
|
|
echo $OUTPUT->box(get_string('globalroleswarning', 'role'));
|
|
|
|
}
|
2008-11-03 06:06:08 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print the form.
|
|
|
|
$assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
|
2008-10-30 10:49:15 +00:00
|
|
|
?>
|
2010-03-31 08:33:17 +00:00
|
|
|
<form id="assignform" method="post" action="<?php echo $assignurl ?>"><div>
|
2008-11-05 08:17:30 +00:00
|
|
|
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
|
2008-10-30 10:49:15 +00:00
|
|
|
|
|
|
|
<table summary="" class="roleassigntable generaltable generalbox boxaligncenter" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td id="existingcell">
|
|
|
|
<p><label for="removeselect"><?php print_string('extusers', 'role'); ?></label></p>
|
|
|
|
<?php $currentuserselector->display() ?>
|
|
|
|
</td>
|
|
|
|
<td id="buttonscell">
|
|
|
|
<div id="addcontrols">
|
2009-12-23 17:44:17 +00:00
|
|
|
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
2008-10-30 10:49:15 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="removecontrols">
|
2009-12-23 17:44:17 +00:00
|
|
|
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
|
2008-10-30 10:49:15 +00:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td id="potentialcell">
|
|
|
|
<p><label for="addselect"><?php print_string('potusers', 'role'); ?></label></p>
|
|
|
|
<?php $potentialuserselector->display() ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2008-11-05 08:17:30 +00:00
|
|
|
</div></form>
|
2008-10-30 10:49:15 +00:00
|
|
|
|
|
|
|
<?php
|
2010-03-31 08:33:17 +00:00
|
|
|
$PAGE->requires->js_init_call('M.core_role.init_add_assign_page');
|
2006-08-08 05:13:06 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
if (!empty($errors)) {
|
|
|
|
$msg = '<p>';
|
|
|
|
foreach ($errors as $e) {
|
|
|
|
$msg .= $e.'<br />';
|
2006-09-19 20:39:55 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
$msg .= '</p>';
|
|
|
|
echo $OUTPUT->box_start();
|
|
|
|
echo $OUTPUT->notification($msg);
|
|
|
|
echo $OUTPUT->box_end();
|
|
|
|
}
|
2006-09-19 20:39:55 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print a form to swap roles, and a link back to the all roles list.
|
|
|
|
echo '<div class="backlink">';
|
2010-03-07 09:28:54 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
$select = new single_select($PAGE->url, 'roleid', $nameswithcounts, $roleid, null);
|
|
|
|
$select->label = get_string('assignanotherrole', 'role');
|
|
|
|
echo $OUTPUT->render($select);
|
2011-01-03 21:09:32 +00:00
|
|
|
$backurl = new moodle_url('/admin/roles/assign.php', array('contextid' => $contextid));
|
|
|
|
echo '<p><a href="' . $backurl->out() . '">' . get_string('backtoallroles', 'role') . '</a></p>';
|
2010-03-31 08:33:17 +00:00
|
|
|
echo '</div>';
|
2008-10-30 06:26:18 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
} else if (empty($assignableroles)) {
|
|
|
|
// Print a message that there are no roles that can me assigned here.
|
|
|
|
echo $OUTPUT->heading(get_string('notabletoassignroleshere', 'role'), 3);
|
2008-11-06 07:34:01 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
} else {
|
|
|
|
// Show UI for choosing a role to assign.
|
2008-11-03 06:06:08 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print a warning if we are assigning system roles.
|
|
|
|
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
|
|
|
echo $OUTPUT->box(get_string('globalroleswarning', 'role'));
|
|
|
|
}
|
2008-11-03 06:06:08 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print instruction
|
|
|
|
echo $OUTPUT->heading(get_string('chooseroletoassign', 'role'), 3);
|
2008-10-30 06:26:18 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Get the names of role holders for roles with between 1 and MAX_USERS_TO_LIST_PER_ROLE users,
|
|
|
|
// and so determine whether to show the extra column.
|
|
|
|
$roleholdernames = array();
|
|
|
|
$strmorethanmax = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE);
|
|
|
|
$showroleholders = false;
|
|
|
|
foreach ($assignableroles as $roleid => $notused) {
|
|
|
|
$roleusers = '';
|
|
|
|
if (0 < $assigncounts[$roleid] && $assigncounts[$roleid] <= MAX_USERS_TO_LIST_PER_ROLE) {
|
|
|
|
$roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname');
|
|
|
|
if (!empty($roleusers)) {
|
|
|
|
$strroleusers = array();
|
|
|
|
foreach ($roleusers as $user) {
|
|
|
|
$strroleusers[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '" >' . fullname($user) . '</a>';
|
2007-10-23 16:27:25 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
$roleholdernames[$roleid] = implode('<br />', $strroleusers);
|
|
|
|
$showroleholders = true;
|
2007-10-23 16:27:25 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
} else if ($assigncounts[$roleid] > MAX_USERS_TO_LIST_PER_ROLE) {
|
|
|
|
$assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
|
|
|
|
$roleholdernames[$roleid] = '<a href="'.$assignurl.'">'.$strmorethanmax.'</a>';
|
|
|
|
} else {
|
|
|
|
$roleholdernames[$roleid] = '';
|
2007-10-29 15:38:46 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
2007-10-29 15:38:46 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
// Print overview table
|
|
|
|
$table = new html_table();
|
|
|
|
$table->tablealign = 'center';
|
|
|
|
$table->width = '60%';
|
|
|
|
$table->head = array(get_string('role'), get_string('description'), get_string('userswiththisrole', 'role'));
|
|
|
|
$table->wrap = array('nowrap', '', 'nowrap');
|
|
|
|
$table->align = array('left', 'left', 'center');
|
|
|
|
if ($showroleholders) {
|
|
|
|
$table->headspan = array(1, 1, 2);
|
|
|
|
$table->wrap[] = 'nowrap';
|
|
|
|
$table->align[] = 'left';
|
|
|
|
}
|
2007-10-29 15:38:46 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
foreach ($assignableroles as $roleid => $rolename) {
|
|
|
|
$description = format_string($DB->get_field('role', 'description', array('id'=>$roleid)));
|
|
|
|
$assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
|
|
|
|
$row = array('<a href="'.$assignurl.'">'.$rolename.'</a>',
|
|
|
|
$description, $assigncounts[$roleid]);
|
|
|
|
if ($showroleholders) {
|
|
|
|
$row[] = $roleholdernames[$roleid];
|
2006-09-15 06:04:10 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
$table->data[] = $row;
|
|
|
|
}
|
2006-09-20 21:00:45 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
echo html_writer::table($table);
|
2008-10-30 06:26:18 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
if ($context->contextlevel > CONTEXT_USER) {
|
2010-04-21 02:43:02 +00:00
|
|
|
echo html_writer::start_tag('div', array('class'=>'backlink'));
|
|
|
|
echo html_writer::tag('a', get_string('backto', '', $contextname), array('href'=>get_context_url($context)));
|
|
|
|
echo html_writer::end_tag('div');
|
2006-08-09 13:18:33 +00:00
|
|
|
}
|
2010-03-31 08:33:17 +00:00
|
|
|
}
|
2006-09-15 06:04:10 +00:00
|
|
|
|
2010-03-31 08:33:17 +00:00
|
|
|
echo $OUTPUT->footer();
|