1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 02:16:06 +02:00

MDL-59821 users: Add proceed to course content

The participants page should show a button to proceed to the course page after creating a new course.

This is a re-implementation of MDL-46238.
This commit is contained in:
Damyon Wiese 2017-08-17 11:07:38 +08:00
parent a88a63e694
commit 5fa2d5021e

@ -24,6 +24,7 @@
require_once('../config.php');
require_once($CFG->dirroot.'/user/lib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->dirroot.'/enrol/locallib.php');
@ -40,13 +41,15 @@ $page = optional_param('page', 0, PARAM_INT); // Which page to show.
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT); // How many per page.
$contextid = optional_param('contextid', 0, PARAM_INT); // One of this or.
$courseid = optional_param('id', 0, PARAM_INT); // This are required.
$newcourse = optional_param('newcourse', false, PARAM_BOOL);
$selectall = optional_param('selectall', false, PARAM_BOOL); // When rendering checkboxes against users mark them all checked.
$PAGE->set_url('/user/index.php', array(
'page' => $page,
'perpage' => $perpage,
'contextid' => $contextid,
'id' => $courseid));
'id' => $courseid,
'newcourse' => $newcourse));
if ($contextid) {
$context = context::instance_by_id($contextid, MUST_EXIST);
@ -293,4 +296,13 @@ foreach ($enrolbuttons as $enrolbutton) {
}
echo '</div>';
if ($newcourse == 1) {
$str = get_string('proceedtocourse', 'enrol');
// Floated left so it goes under the enrol users button on mobile.
// The margin is to make it line up with the enrol users button when they are both on the same line.
$classes = 'm-y-1 pull-xs-left';
$url = course_get_url($course);
echo $OUTPUT->single_button($url, $str, 'GET', array('class' => $classes));
}
echo $OUTPUT->footer();