MDL-18309 Course: enrol/index.php returnurl improvement
This patch improves usability of enrolment page in case of course is not enrollable. 'Continue' button now returns student to referring page instead of main moodle page (as it used to be). To make this improvement, passing correct returnurl parameter to enrol/index.php page was implemented for links that may be accessible for not-enrolled students.
This commit is contained in:
committed by
Marina Glancy
parent
d7551257a0
commit
6601690202
+5
-1
@@ -49,6 +49,9 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
protected $strings;
|
||||
|
||||
/** @var moodle_url|null stores page where to return to from the enrolment page */
|
||||
public $returnurl;
|
||||
|
||||
/**
|
||||
* Override the constructor so that we can initialise the string cache
|
||||
*
|
||||
@@ -1207,7 +1210,8 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
|
||||
// course name
|
||||
$coursename = $chelper->get_course_formatted_name($course);
|
||||
$coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
|
||||
$coursenamelink = html_writer::link(new moodle_url('/course/view.php',
|
||||
array('id' => $course->id, 'returnurl' => $this->returnurl)),
|
||||
$coursename, array('class' => $course->visible ? '' : 'dimmed'));
|
||||
$content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename'));
|
||||
// If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
|
||||
|
||||
Reference in New Issue
Block a user