Merge branch 'MDL-86142' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -105,6 +105,7 @@ final class courses_test extends core_reportbuilder_testcase {
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:coursefullnamewithlink']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:courseshortnamewithlink']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:courseidnumberewithlink']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:url']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:summary']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:format']);
|
||||
$generator->create_column(['reportid' => $report->get('id'), 'uniqueidentifier' => 'course:startdate']);
|
||||
@@ -133,6 +134,7 @@ final class courses_test extends core_reportbuilder_testcase {
|
||||
$coursenamewithlink,
|
||||
$courseshortnamewithlink,
|
||||
$courseidnumberwithlink,
|
||||
$courseurl,
|
||||
$coursesummary,
|
||||
$courseformat,
|
||||
$coursestartdate,
|
||||
@@ -152,9 +154,11 @@ final class courses_test extends core_reportbuilder_testcase {
|
||||
] = array_values($content[0]);
|
||||
|
||||
// Course.
|
||||
$this->assertStringContainsString($course->fullname, $coursenamewithlink);
|
||||
$this->assertStringContainsString($course->shortname, $courseshortnamewithlink);
|
||||
$this->assertStringContainsString($course->idnumber, $courseidnumberwithlink);
|
||||
$expectedcourseurl = (string) course_get_url($course);
|
||||
$this->assertEquals("<a href=\"{$expectedcourseurl}\">{$course->fullname}</a>", $coursenamewithlink);
|
||||
$this->assertEquals("<a href=\"{$expectedcourseurl}\">{$course->shortname}</a>", $courseshortnamewithlink);
|
||||
$this->assertEquals("<a href=\"{$expectedcourseurl}\">{$course->idnumber}</a>", $courseidnumberwithlink);
|
||||
$this->assertEquals($expectedcourseurl, $courseurl);
|
||||
$this->assertEquals(format_text($course->summary, $course->summaryformat), $coursesummary);
|
||||
$this->assertEquals('Custom sections', $courseformat);
|
||||
$this->assertEquals(userdate($course->startdate), $coursestartdate);
|
||||
|
||||
@@ -72,6 +72,7 @@ $string['coursenotyetstarted'] = 'The course has not yet started';
|
||||
$string['coursenotyetfinished'] = 'The course has not yet finished';
|
||||
$string['courseparticipants'] = 'Course participants';
|
||||
$string['coursetoolong'] = 'The course is too long';
|
||||
$string['courseurl'] = 'Course URL';
|
||||
$string['customfield_islocked'] = 'Locked';
|
||||
$string['customfield_islocked_help'] = 'If the field is locked, only users with the capability to change locked custom fields (by default users with the default role of manager only) will be able to change it in the course settings.';
|
||||
$string['customfield_notvisible'] = 'Nobody';
|
||||
|
||||
@@ -230,6 +230,22 @@ class course extends base {
|
||||
});
|
||||
}
|
||||
|
||||
// Course URL.
|
||||
$columns[] = (new column(
|
||||
'url',
|
||||
new lang_string('courseurl', 'core_course'),
|
||||
$this->get_entity_name(),
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->add_fields("{$tablealias}.id, {$tablealias}.format")
|
||||
->add_callback(static function (?string $courseid, stdClass $course): string {
|
||||
if ($courseid === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (string) course_get_url($course);
|
||||
});
|
||||
|
||||
foreach ($coursefields as $coursefield => $coursefieldlang) {
|
||||
$column = (new column(
|
||||
$coursefield,
|
||||
|
||||
Reference in New Issue
Block a user