Skip to content

Commit

Permalink
Merge branch 'MDL-72699' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Jun 15, 2022
2 parents 85463a8 + b6f4ec6 commit b0da507
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions course/pending.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
$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) {
Expand All @@ -131,10 +131,16 @@
}
$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);
Expand Down
8 changes: 6 additions & 2 deletions course/tests/behat/course_request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b0da507

Please sign in to comment.