From b6f4ec679f88cafe985aebf9589801225d01a052 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 4 Oct 2021 18:46:50 +0100 Subject: [PATCH] MDL-72699 course: link to profile of user who requested course. --- course/pending.php | 10 ++++++++-- course/tests/behat/course_request.feature | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/course/pending.php b/course/pending.php index 85a59f4d2bf..8a0b88a37f8 100644 --- a/course/pending.php +++ b/course/pending.php @@ -117,7 +117,7 @@ if (empty($pending)) { $table = new html_table(); $table->attributes['class'] = 'pendingcourserequests generaltable'; $table->align = array('center', 'center', 'center', 'center', 'center', 'center'); - $table->head = array(get_string('shortnamecourse'), get_string('fullnamecourse'), get_string('requestedby'), + $table->head = array(get_string('requestedby'), get_string('shortnamecourse'), get_string('fullnamecourse'), get_string('summary'), get_string('category'), get_string('requestreason'), get_string('action')); foreach ($pending as $course) { @@ -131,10 +131,16 @@ if (empty($pending)) { } $category = $course->get_category(); + // Fullname of the user who requested the course (with link to profile if current user can view it). + $requesterfullname = $OUTPUT->user_picture($course->get_requester(), [ + 'includefullname' => true, + 'link' => user_can_view_profile($course->get_requester()), + ]); + $row = array(); + $row[] = $requesterfullname; $row[] = format_string($course->shortname); $row[] = format_string($course->fullname); - $row[] = fullname($course->get_requester()); $row[] = format_text($course->summary, $course->summaryformat); $row[] = $category->get_formatted_name(); $row[] = format_string($course->reason); diff --git a/course/tests/behat/course_request.feature b/course/tests/behat/course_request.feature index f9ba5f7b3c9..89c36c5ae65 100644 --- a/course/tests/behat/course_request.feature +++ b/course/tests/behat/course_request.feature @@ -40,7 +40,9 @@ Feature: Users can request and approve courses And I am on course index And I click on "More actions" "button" And I click on "Courses pending approval" "link" - And I should see "Category 1" in the "My new course" "table_row" + And the following should exist in the "pendingcourserequests" table: + | Requested by | Course short name | Course full name | Category | Reason for course request | + | User 1 | Mynewcourse | My new course | Category 1 | pretty please | And I click on "Approve" "button" in the "My new course" "table_row" And I press "Save and return" And I should see "There are no courses pending approval" @@ -103,7 +105,9 @@ Feature: Users can request and approve courses And I follow "English category" And I click on "More actions" "button" And I click on "Courses pending approval" "link" - And I should see "English category" in the "Mynewcourse" "table_row" + And the following should exist in the "pendingcourserequests" table: + | Requested by | Course short name | Course full name | Category | Reason for course request | + | User 1 | Mynewcourse | My new course | English category | pretty please | And I click on "Approve" "button" in the "Mynewcourse" "table_row" And I press "Save and return" And I am on course index