MDL-71189 core_completion: Adding completion sort order to activities

This implements sort ordering for all completion conditions, in
activities which support custom completion conditions.
This commit is contained in:
Michael Hawkins 2021-04-08 14:21:09 +08:00
parent f105612d7f
commit b77c66ac10
13 changed files with 163 additions and 1 deletions

View File

@ -78,5 +78,17 @@ class custom_completion extends activity_custom_completion {
'completionsubmit' => get_string('completiondetail:submit', 'assign')
];
}
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionsubmit',
'completionusegrade',
];
}
}

View File

@ -69,4 +69,16 @@ class custom_completion extends activity_custom_completion {
'completionsubmit' => get_string('completiondetail:submit', 'choice')
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionsubmit',
];
}
}

View File

@ -69,4 +69,17 @@ class custom_completion extends activity_custom_completion {
'completionentries' => get_string('completiondetail:entries', 'data', $entries),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionentries',
'completionusegrade',
];
}
}

View File

@ -67,4 +67,16 @@ class custom_completion extends activity_custom_completion {
'completionsubmit' => get_string('completiondetail:submit', 'feedback')
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionsubmit',
];
}
}

View File

@ -99,4 +99,19 @@ class custom_completion extends activity_custom_completion {
'completionposts' => get_string('completiondetail:posts', 'forum', $completionposts),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completiondiscussions',
'completionreplies',
'completionposts',
'completionusegrade',
];
}
}

View File

@ -73,4 +73,17 @@ class custom_completion extends activity_custom_completion {
'completionentries' => get_string('completiondetail:entries', 'glossary', $completionentries),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionentries',
'completionusegrade',
];
}
}

View File

@ -70,4 +70,14 @@ class custom_completion extends activity_custom_completion {
public function manual_completion_always_shown(): bool {
return true;
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
// This module only supports manual completion.
return [];
}
}

View File

@ -91,4 +91,18 @@ class custom_completion extends activity_custom_completion {
'completionendreached' => get_string('completiondetail:reachend', 'lesson'),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completiontimespent',
'completionendreached',
'completionusegrade',
];
}
}

View File

@ -159,4 +159,18 @@ class custom_completion extends activity_custom_completion {
'completionminattempts' => get_string('completiondetail:minattempts', 'mod_quiz', $minattempts),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionminattempts',
'completionusegrade',
'completionpassorattemptsexhausted',
];
}
}

View File

@ -79,4 +79,14 @@ class custom_completion extends activity_custom_completion {
return in_array($display, $displaytypes);
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
// This module only supports manual completion.
return [];
}
}

View File

@ -202,4 +202,20 @@ class custom_completion extends activity_custom_completion {
'completionstatusallscos' => get_string('completiondetail:allscos', 'scorm'),
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionstatusallscos',
'completionstatusrequired',
'completionusegrade',
'completionscorerequired',
];
}
}

View File

@ -67,4 +67,16 @@ class custom_completion extends activity_custom_completion {
'completionsubmit' => get_string('completiondetail:submit', 'survey')
];
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionsubmit',
];
}
}

View File

@ -82,4 +82,13 @@ class custom_completion extends activity_custom_completion {
return in_array($display, $displaytypes);
}
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
// This module only supports manual completion.
return [];
}
}