$hidden = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
$extendperiod = optional_param('extendperiod', 0, PARAM_INT);
$extendbase = optional_param('extendbase', 3, PARAM_INT);
+ $returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
$urlparams = array('contextid' => $contextid);
if (!empty($userid)) {
if ($courseid && $courseid != SITEID) {
$urlparams['courseid'] = $courseid;
}
+ if ($returnurl) {
+ $urlparams['returnurl'] = $returnurl;
+ }
$PAGE->set_url($CFG->admin . '/roles/assign.php', $urlparams);
$baseurl = $PAGE->url->out();
if (!$isfrontpage && ($url = get_context_url($context))) {
echo '<div class="backlink"><a href="' . $url . '">' .
get_string('backto', '', $contextname) . '</a></div>';
+ } else if ($returnurl) {
+ echo '<div class="backlink"><a href="' . $CFG->wwwroot . '/' . $returnurl . '">' .
+ get_string('backtopageyouwereon') . '</a></div>';
}
}
- if ($context->contextlevel == CONTEXT_SYSTEM || $isfrontpage) {
- admin_externalpage_print_footer();
- } else {
- print_footer();
- }
-?>
+ print_footer();
$contextid = required_param('contextid',PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
+ $returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
$urlparams = array('contextid' => $contextid);
if (!empty($userid)) {
if ($courseid && $courseid != SITEID) {
$urlparams['courseid'] = $courseid;
}
+ if ($returnurl) {
+ $urlparams['returnurl'] = $returnurl;
+ }
$PAGE->set_url($CFG->admin . '/roles/check.php', $urlparams);
if (! $context = get_context_instance_by_id($contextid)) {
if (!$isfrontpage && ($url = get_context_url($context))) {
echo '<div class="backlink"><a href="' . $url . '">' .
get_string('backto', '', $contextname) . '</a></div>';
+ } else if ($returnurl) {
+ echo '<div class="backlink"><a href="' . $CFG->wwwroot . '/' . $returnurl . '">' .
+ get_string('backtopageyouwereon') . '</a></div>';
}
print_footer();
$roleid = optional_param('roleid', 0, PARAM_INT); // requested role id
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
+ $returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
/// Get the base URL for this and related pages into a convenient variable.
$urlparams = array('contextid' => $contextid);
if ($courseid && $courseid != SITEID) {
$urlparams['courseid'] = $courseid;
}
+ if ($returnurl) {
+ $urlparams['returnurl'] = $returnurl;
+ }
$PAGE->set_url($CFG->admin . '/roles/override.php', $urlparams);
$baseurl = $PAGE->url->out();
if (!$isfrontpage && ($url = get_context_url($context))) {
echo '<div class="backlink"><a href="' . $url . '">' .
get_string('backto', '', $contextname) . '</a></div>';
+ } else if ($returnurl) {
+ echo '<div class="backlink"><a href="' . $CFG->wwwroot . '/' . $returnurl . '">' .
+ get_string('backtopageyouwereon') . '</a></div>';
}
}
print_footer();
-?>
\ No newline at end of file
if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context
+ if (!empty($returnurl)) {
+ $returnurlparam = '&returnurl=' . $returnurl;
+ } else {
+ $returnurlparam = '';
+ }
+
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('settings'));
if (!empty($assignableroles) || $currenttab=='assign') {
$toprow[] = new tabobject('assign',
- $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
+ $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.$returnurlparam,
get_string('localroles', 'role'), '', true);
}
if (!empty($overridableroles)) {
$toprow[] = new tabobject('override',
- $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
+ $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id.$returnurlparam,
get_string('overridepermissions', 'role'), '', true);
}
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride',
'moodle/role:override', 'moodle/role:assign'), $context)) {
$toprow[] = new tabobject('check',
- $CFG->wwwroot.'/'.$CFG->admin.'/roles/check.php?contextid='.$context->id,
+ $CFG->wwwroot.'/'.$CFG->admin.'/roles/check.php?contextid='.$context->id.$returnurlparam,
get_string('checkpermissions', 'role'));
}
$string['back'] = 'Back';
$string['backto'] = 'Back to $a';
$string['backtocourselisting'] = 'Back to course listing';
+$string['backtopageyouwereon'] = 'Back to the page you were on';
$string['backup'] = 'Backup';
$string['backupactivehelp'] = 'Choose whether or not to do automated backups.';
$string['backupcancelled'] = 'Backup Cancelled';
$controls = array();
$actionurl = $page->url->out_action();
+ $returnurlparam = '&returnurl=' . urlencode($page->url->out_returnurl());
// Assign roles icon.
if (has_capability('moodle/role:assign', $block->context)) {
- $controls[] = array('url' => $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$block->context->id,
+ $controls[] = array('url' => $CFG->wwwroot . '/' . $CFG->admin .
+ '/roles/assign.php?contextid=' . $block->context->id . $returnurlparam,
'icon' => 'i/roles', 'caption' => get_string('assignroles', 'role'));
}
if (!empty($block->instance->blockpositionid)) {
$editurl .= '&positionid=' . $block->instance->blockpositionid;
}
- $controls[] = array('url' => $editurl . '&returnurl=' . urlencode($page->url->out_returnurl()),
+ $controls[] = array('url' => $editurl . $returnurlparam,
'icon' => 't/edit', 'caption' => get_string('configuration'));
}