Skip to content

Commit

Permalink
MDL-46238 enrol:add a simple way to go back to course page
Browse files Browse the repository at this point in the history
  • Loading branch information
shashitechno committed Feb 19, 2015
1 parent 95751e8 commit bbc3b07
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion course/edit.php
Expand Up @@ -169,7 +169,7 @@
if ($plugin = enrol_get_plugin($instance->enrol)) {
if ($plugin->get_manual_enrol_link($instance)) {
// We know that the ajax enrol UI will have an option to enrol.
$courseurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
$courseurl = new moodle_url('/enrol/users.php', array('id' => $course->id, 'newcourse' => 1));
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion enrol/renderer.php
Expand Up @@ -45,7 +45,7 @@ public function render_course_enrolment_users_table(course_enrolment_users_table
$buttons = $table->get_manual_enrol_buttons();
$buttonhtml = '';
if (count($buttons) > 0) {
$buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons'));
$buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons enrol-users-page-action'));
foreach ($buttons as $button) {
$buttonhtml .= $this->render($button);
}
Expand Down
7 changes: 6 additions & 1 deletion enrol/users.php
Expand Up @@ -35,6 +35,7 @@
$role = optional_param('role', 0, PARAM_INT);
$fgroup = optional_param('filtergroup', 0, PARAM_INT);
$status = optional_param('status', -1, PARAM_INT);
$newcourse = optional_param('newcourse', false, PARAM_BOOL);

// When users reset the form, redirect back to first page without other params.
if (optional_param('resetbutton', '', PARAM_RAW) !== '') {
Expand All @@ -54,7 +55,7 @@

$manager = new course_enrolment_manager($PAGE, $course, $filter, $role, $search, $fgroup, $status);
$table = new course_enrolment_users_table($manager, $PAGE);
$PAGE->set_url('/enrol/users.php', $manager->get_url_params()+$table->get_url_params());
$PAGE->set_url('/enrol/users.php', $manager->get_url_params()+$table->get_url_params()+array('newcourse' => $newcourse));
navigation_node::override_active_url(new moodle_url('/enrol/users.php', array('id' => $id)));

// Check if there is an action to take
Expand Down Expand Up @@ -240,4 +241,8 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolledusers', 'enrol'));
echo $renderer->render_course_enrolment_users_table($table, $filterform);
if ($newcourse == 1) {
echo $OUTPUT->single_button(new moodle_url('/course/view.php', array('id' => $id)),
get_string('proceedtocourse', 'enrol'), 'GET', array('class' => 'enrol-users-page-action'));
}
echo $OUTPUT->footer();
1 change: 1 addition & 0 deletions lang/en/enrol.php
Expand Up @@ -104,6 +104,7 @@
$string['periodnone'] = 'enrolled {$a}';
$string['periodstart'] = 'from {$a}';
$string['periodstartend'] = 'from {$a->start} until {$a->end}';
$string['proceedtocourse'] = 'Proceed to course content';
$string['recovergrades'] = 'Recover user\'s old grades if possible';
$string['rolefromthiscourse'] = '{$a->role} (Assigned in this course)';
$string['rolefrommetacourse'] = '{$a->role} (Inherited from parent course)';
Expand Down
4 changes: 4 additions & 0 deletions theme/bootstrapbase/less/moodle.less
Expand Up @@ -75,3 +75,7 @@ body {

@import "moodle/debug";
@import "moodle/expendable";

.enrol-users-page-action {
margin-left:-5px;
}
2 changes: 1 addition & 1 deletion theme/bootstrapbase/style/moodle.css

Large diffs are not rendered by default.

0 comments on commit bbc3b07

Please sign in to comment.