Skip to content

Commit

Permalink
Merge branch 'MDL-77178-master' of https://github.com/aanabit/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden authored and sarjona committed Mar 21, 2023
2 parents 89cb8b4 + d535182 commit 718108c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 68 deletions.
5 changes: 2 additions & 3 deletions admin/tool/monitor/tests/behat/course_report_monitor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Event monitoring rules" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Event monitoring rules"
And the field "Report" matches value "Event monitoring rules"
Then "Report type" "field" should exist
And I should see "Event monitoring rules" in the "Report type" "field"
19 changes: 13 additions & 6 deletions lib/classes/report_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

namespace core;
use moodle_url;
use url_select;

/**
* A helper class with static methods to help report plugins
Expand Down Expand Up @@ -75,12 +74,20 @@ public static function print_report_selector(string $pluginname):void {
}

}

$select = new url_select($menuarray, $activeurl, null, 'choosecoursereport');
$select->set_label(get_string('reporttype'), ['class' => 'accesshide']);
echo \html_writer::tag('div', $OUTPUT->render($select), ['class' => 'tertiary-navigation']);
$selectmenu = new \core\output\select_menu('reporttype', $menuarray, $activeurl);
$selectmenu->set_label(get_string('reporttype'), ['class' => 'sr-only']);
$options = \html_writer::tag(
'div',
$OUTPUT->render_from_template('core/tertiary_navigation_selector', $selectmenu->export_for_template($OUTPUT)),
['class' => 'row pb-3']
);
echo \html_writer::tag(
'div',
$options,
['class' => 'tertiary-navigation full-width-bottom-border ml-0', 'id' => 'tertiary-navigation']);
} else {
echo $OUTPUT->heading($pluginname, 2, 'mb-3');
}
echo $OUTPUT->heading($pluginname, 2, 'mb-3');
}

/**
Expand Down
38 changes: 0 additions & 38 deletions lib/tests/report_helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,42 +75,4 @@ public function test_save_selected_report(array $courseurlid):void {

$this->assertEquals($USER->course_last_report[$courseid2], $url2);
}

/**
* Testing the report selector dropdown shown.
*
* Verify that the dropdowns have the pages to be displayed.
*
* @return void
*/
public function test_print_report_selector():void {
global $PAGE;

$this->resetAfterTest();

$user = $this->getDataGenerator()->create_user();

$PAGE->set_url('/');

$course = $this->getDataGenerator()->create_course();
$PAGE->set_course($course);

$this->getDataGenerator()->enrol_user($user->id, $course->id, 'teacher');

$this->setUser($user);

ob_start();
report_helper::print_report_selector('Logs');
$output = $this->getActualOutput();
ob_end_clean();

$log = '<option value="/report/log/index.php?id=' . $course->id .'" selected>Logs</option>';
$competency = '<option value="/report/competency/index.php?id=' . $course->id . '" >Competency breakdown</option>';
$loglive = '<option value="/report/loglive/index.php?id=' . $course->id . '" >Live logs</option>';
$participation = '<option value="/report/participation/index.php?id=' . $course->id . '" >Course participation</option>';
$this->assertStringContainsString($log, $output);
$this->assertStringContainsString($competency, $output);
$this->assertStringContainsString($loglive, $output);
$this->assertStringContainsString($participation, $output);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Competency breakdown" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Competency breakdown"
And the field "Report" matches value "Competency breakdown"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Competency breakdown" in the "tertiary-navigation" "region"
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Course completion" "link" in the "region-main" "region"
Then "Report" "field" should exist
And the "Report" select box should contain "Course completion"
And the field "Report" matches value "Course completion"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Course completion" in the "tertiary-navigation" "region"
5 changes: 2 additions & 3 deletions report/log/tests/behat/course_report_log.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Logs" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Logs"
And the field "Report" matches value "Logs"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Logs" in the "tertiary-navigation" "region"
5 changes: 2 additions & 3 deletions report/loglive/tests/behat/course_report_loglive.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Live logs" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Live logs"
And the field "Report" matches value "Live logs"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Live logs" in the "tertiary-navigation" "region"
5 changes: 2 additions & 3 deletions report/outline/tests/behat/course_report_outline.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Activity report" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Activity report"
And the field "Report" matches value "Activity report"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Activity report" in the "tertiary-navigation" "region"
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Course participation" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Course participation"
And the field "Report" matches value "Course participation"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Course participation" in the "tertiary-navigation" "region"
5 changes: 2 additions & 3 deletions report/progress/tests/behat/course_report_progress.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ Feature: In a course administration page, navigate through report page, test for
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Activity completion" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Activity completion"
And the field "Report" matches value "Activity completion"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Activity completion" in the "tertiary-navigation" "region"

Scenario: Custom profile fields selected for identity should display on the activity completion report
Given the following "custom profile fields" exist:
Expand Down

0 comments on commit 718108c

Please sign in to comment.