MDL-72699 course: link to profile of user who requested course.

This commit is contained in:
Paul Holden
2022-06-15 10:57:50 +01:00
parent ca583bddaf
commit b6f4ec679f
2 changed files with 14 additions and 4 deletions
+8 -2
View File
@@ -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);
+6 -2
View File
@@ -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