Skip to content

Commit

Permalink
MDL-59370 enrol: Kill the enrol/users page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Aug 14, 2017
1 parent f3625f4 commit 4b50765
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 427 deletions.
2 changes: 1 addition & 1 deletion course/classes/management/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public static function get_course_detail_actions(\course_in_list $course) {
// Permissions.
if ($course->can_review_enrolments()) {
$actions['enrolledusers'] = array(
'url' => new \moodle_url('/enrol/users.php', array('id' => $course->id)),
'url' => new \moodle_url('/user/index.php', array('id' => $course->id)),
'string' => \get_string('enrolledusers', 'enrol')
);
}
Expand Down
2 changes: 1 addition & 1 deletion course/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,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, 'newcourse' => 1));
$courseurl = new moodle_url('/user/index.php', array('id' => $course->id, 'newcourse' => 1));
break;
}
}
Expand Down
93 changes: 0 additions & 93 deletions enrol/bulkchange.php

This file was deleted.

2 changes: 1 addition & 1 deletion enrol/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public function get_group($groupid) {
*/
public function edit_enrolment($userenrolment, $data) {
//Only allow editing if the user has the appropriate capability
//Already checked in /enrol/users.php but checking again in case this function is called from elsewhere
//Already checked in /user/index.php but checking again in case this function is called from elsewhere
list($instance, $plugin) = $this->get_user_enrolment_components($userenrolment);
if ($instance && $plugin && $plugin->allow_manage($instance) && has_capability("enrol/$instance->enrol:manage", $this->context)) {
if (!isset($data->status)) {
Expand Down
2 changes: 1 addition & 1 deletion enrol/manual/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
$PAGE->set_pagelayout('admin');
$PAGE->set_title($enrol_manual->get_instance_name($instance));
$PAGE->set_heading($course->fullname);
navigation_node::override_active_url(new moodle_url('/enrol/users.php', array('id'=>$course->id)));
navigation_node::override_active_url(new moodle_url('/user/index.php', array('id'=>$course->id)));

// Create the user selector objects.
$options = array('enrolid' => $enrolid, 'accesscontext' => $context);
Expand Down
66 changes: 0 additions & 66 deletions enrol/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,72 +30,6 @@
*/
class core_enrol_renderer extends plugin_renderer_base {

/**
* Renders a course enrolment table
*
* @param course_enrolment_table $table
* @param moodleform $mform Form that contains filter controls
* @return string
*/
public function render_course_enrolment_users_table(course_enrolment_users_table $table,
moodleform $mform) {

$table->initialise_javascript();

$buttons = $table->get_manual_enrol_buttons();
$buttonhtml = '';
if (count($buttons) > 0) {
$buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons enrol-users-page-action'));
foreach ($buttons as $button) {
$buttonhtml .= $this->render($button);
}
$buttonhtml .= html_writer::end_tag('div');
}

$content = '';
if (!empty($buttonhtml)) {
$content .= $buttonhtml;
}
$content .= html_writer::start_tag('div', array('class' => 'form-inline'));
$content .= $mform->render();
$content .= html_writer::end_tag('div');

$content .= $this->output->render($table->get_paging_bar());

// Check if the table has any bulk operations. If it does we want to wrap the table in a
// form so that we can capture and perform any required bulk operations.
if ($table->has_bulk_user_enrolment_operations()) {
$content .= html_writer::start_tag('form', array('action' => new moodle_url('/enrol/bulkchange.php'), 'method' => 'post'));
foreach ($table->get_combined_url_params() as $key => $value) {
if ($key == 'action') {
continue;
}
$content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
}
$content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'bulkchange'));
$content .= html_writer::table($table);
$content .= html_writer::start_tag('div', array('class' => 'singleselect bulkuserop'));
$content .= html_writer::start_tag('select', array('name' => 'bulkuserop'));
$content .= html_writer::tag('option', get_string('withselectedusers', 'enrol'), array('value' => ''));
$options = array('' => get_string('withselectedusers', 'enrol'));
foreach ($table->get_bulk_user_enrolment_operations() as $operation) {
$content .= html_writer::tag('option', $operation->get_title(), array('value' => $operation->get_identifier()));
}
$content .= html_writer::end_tag('select');
$content .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
$content .= html_writer::end_tag('div');

$content .= html_writer::end_tag('form');
} else {
$content .= html_writer::table($table);
}
$content .= $this->output->render($table->get_paging_bar());
if (!empty($buttonhtml)) {
$content .= $buttonhtml;
}
return $content;
}

/**
* Renderers the enrol_user_button.
*
Expand Down
5 changes: 5 additions & 0 deletions enrol/upgrade.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
This files describes API changes in /enrol/* - plugins,
information provided here is intended especially for developers.

=== 3.4 ===

* render_course_enrolment_users_table method has been removed from the renderer. The enrolled users page is now
combined with the participants page. /enrol/users.php no longer exists.

=== 3.3 ===

* External function core_enrol_external::get_users_courses now return the user progress, start and the end course dates.
Expand Down
Loading

0 comments on commit 4b50765

Please sign in to comment.