mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 07:25:30 +02:00
Merge branch 'MDL-77980' of https://github.com/paulholden/moodle
This commit is contained in:
commit
084fa3fb15
@ -4088,21 +4088,15 @@ abstract class grade_helper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link to grading page if grade.php exists in the module or link to activity
|
||||
* Returns a link to activity
|
||||
*
|
||||
* @param array $element An array representing an element in the grade_tree
|
||||
*
|
||||
* @return string|null link to grading page|activity or null if not found
|
||||
* @return moodle_url|null link to activity or null if not found
|
||||
*/
|
||||
public static function get_activity_link(array $element): ?string {
|
||||
global $CFG;
|
||||
/** @var array static cache of the grade.php file existence flags */
|
||||
static $hasgradephp = [];
|
||||
|
||||
public static function get_activity_link(array $element): ?moodle_url {
|
||||
$itemtype = $element['object']->itemtype;
|
||||
$itemmodule = $element['object']->itemmodule;
|
||||
$iteminstance = $element['object']->iteminstance;
|
||||
$itemnumber = $element['object']->itemnumber;
|
||||
|
||||
// Links only for module items that have valid instance, module and are
|
||||
// called from grade_tree with valid modinfo.
|
||||
@ -4123,23 +4117,6 @@ abstract class grade_helper {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!array_key_exists($itemmodule, $hasgradephp)) {
|
||||
if (file_exists($CFG->dirroot . '/mod/' . $itemmodule . '/grade.php')) {
|
||||
$hasgradephp[$itemmodule] = true;
|
||||
} else {
|
||||
$hasgradephp[$itemmodule] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If module has grade.php, link to that, otherwise view.php.
|
||||
if ($hasgradephp[$itemmodule]) {
|
||||
$args = ['id' => $cm->id, 'itemnumber' => $itemnumber];
|
||||
if (isset($element['userid'])) {
|
||||
$args['userid'] = $element['userid'];
|
||||
}
|
||||
return new moodle_url('/mod/' . $itemmodule . '/grade.php', $args);
|
||||
} else {
|
||||
return new moodle_url('/mod/' . $itemmodule . '/view.php', ['id' => $cm->id]);
|
||||
}
|
||||
return new moodle_url('/mod/' . $itemmodule . '/view.php', ['id' => $cm->id]);
|
||||
}
|
||||
}
|
||||
|
@ -881,7 +881,7 @@ class grade_report_grader extends grade_report {
|
||||
$collapsedicon = $OUTPUT->render_from_template('gradereport_grader/collapse/icon', $collapsecontext);
|
||||
}
|
||||
$headerlink = grade_helper::get_element_header($element, true,
|
||||
true, false, false, true, $sortlink);
|
||||
true, false, false, true);
|
||||
|
||||
$itemcell = new html_table_cell();
|
||||
$itemcell->attributes['class'] = $type . ' ' . $catlevel .
|
||||
@ -1949,9 +1949,7 @@ class grade_report_grader extends grade_report {
|
||||
$requirednames = order_in_string(\core_user\fields::get_name_fields(), $nameformat);
|
||||
if (!empty($requirednames)) {
|
||||
foreach ($requirednames as $name) {
|
||||
$arrows['studentname'] .= html_writer::link(
|
||||
new moodle_url($this->baseurl, array('sortitemid' => $name)), get_string($name)
|
||||
);
|
||||
$arrows['studentname'] .= get_string($name);
|
||||
if ($this->sortitemid == $name) {
|
||||
$sortlink->param('sortitemid', $name);
|
||||
if ($this->sortorder == 'ASC') {
|
||||
@ -1975,10 +1973,8 @@ class grade_report_grader extends grade_report {
|
||||
if (preg_match(\core_user\fields::PROFILE_FIELD_REGEX, $field)) {
|
||||
$attributes['data-collapse-name'] = \core_user\fields::get_display_name($field);
|
||||
}
|
||||
$fieldlink = html_writer::link(new moodle_url($this->baseurl, ['sortitemid' => $field]),
|
||||
\core_user\fields::get_display_name($field), $attributes);
|
||||
$arrows[$field] = $fieldlink;
|
||||
|
||||
$arrows[$field] = html_writer::span(\core_user\fields::get_display_name($field), '', $attributes);
|
||||
if ($field == $this->sortitemid) {
|
||||
$sortlink->param('sortitemid', $field);
|
||||
|
||||
|
@ -77,54 +77,3 @@ Feature: We can sort grades/user fields on the grader report
|
||||
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentD 1" "table_row"
|
||||
And "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
|
||||
|
||||
@javascript
|
||||
Scenario: Sort grades or user fields on grader report by using element header
|
||||
When I am on "Course 1" course homepage with editing mode on
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
# Default sorting is lastname ascending.
|
||||
And "StudentD 1" "table_row" should appear before "StudentA 2" "table_row"
|
||||
And "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
|
||||
# Sort by grades in ascending order.
|
||||
And I click on "Test assignment name 1" "link" in the "region-main" "region"
|
||||
And I wait until the page is ready
|
||||
Then "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
|
||||
And "StudentB 4" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentA 2" "table_row"
|
||||
# Sort by grades in descending order.
|
||||
And I click on "Test assignment name 1" "link" in the "region-main" "region"
|
||||
And I wait until the page is ready
|
||||
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
|
||||
And "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
|
||||
# Sort by email in ascending order.
|
||||
And I click on "Email address" "link" in the "region-main" "region"
|
||||
And I wait until the page is ready
|
||||
Then "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
|
||||
And "StudentD 1" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentA 2" "table_row"
|
||||
# Sort by email in descending order.
|
||||
And I click on "Email address" "link" in the "region-main" "region"
|
||||
And I wait until the page is ready
|
||||
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentD 1" "table_row"
|
||||
And "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
|
||||
# Sort by firstname in ascending order.
|
||||
And I click on "First name" "link"
|
||||
And I wait until the page is ready
|
||||
Then "StudentA 2" "table_row" should appear before "StudentB 4" "table_row"
|
||||
And "StudentB 4" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentD 1" "table_row"
|
||||
# Sort by firstname in descending order.
|
||||
And I click on "First name" "link"
|
||||
And I wait until the page is ready
|
||||
Then "StudentD 1" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
|
||||
And "StudentB 4" "table_row" should appear before "StudentA 2" "table_row"
|
||||
# Sort by lastname in ascending order.
|
||||
And I click on "Last name" "link"
|
||||
And I wait until the page is ready
|
||||
Then "StudentD 1" "table_row" should appear before "StudentA 2" "table_row"
|
||||
And "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
|
||||
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
|
||||
|
@ -120,7 +120,7 @@ Feature: Within the grader report, test that we can open our generic filter drop
|
||||
# Click off the drop down
|
||||
And I click on "Filter by name" "combobox"
|
||||
And "input[data-action=save]" "css_element" should be visible
|
||||
And I click on "First name" "link" in the "gradereport-grader-table" "table"
|
||||
And I click on user profile field menu "fullname"
|
||||
And "input[data-action=save]" "css_element" should not be visible
|
||||
|
||||
Scenario: A teacher using a language besides english can reset the initials bar
|
||||
|
@ -373,7 +373,8 @@ Feature: Within the grader report, test that we can search for users
|
||||
And I reload the page
|
||||
And I turn editing mode on
|
||||
And the field "perpage" matches value "20"
|
||||
And I click on "Last name" "link"
|
||||
And I click on user profile field menu "fullname"
|
||||
And I choose "Ascending" in the open action menu
|
||||
And I wait until the page is ready
|
||||
# Search for a single user on second page and save grades.
|
||||
When I set the field "Search users" to "test32"
|
||||
|
@ -6,6 +6,7 @@ Information provided here is intended especially for developers.
|
||||
* The grade_structure::get_element_type_string() function has been deprecated. Please use grade_helper::get_element_type_string() instead.
|
||||
* The grade_structure::get_element_header() function has been deprecated. Please use grade_helper::get_element_header() instead.
|
||||
* The grade_structure::get_activity_link() functions has been deprecated. Please use grade_helper::get_activity_link() instead.
|
||||
* The `grade_helper::get_activity_link` method will only return URL to activities view.php page (no longer to the grade.php page)
|
||||
* Some changes to how print_grade_page_head() sets the page title:
|
||||
* If a non-empty `$heading` parameter is passed, it will be used as the page title's unique identifying information.
|
||||
* Add support for grade report plugins that define an `editingmode_title` lang string. If the grade report plugin defines this
|
||||
|
Loading…
x
Reference in New Issue
Block a user