MDL-71457 theme_boost: activity icon styling

This commit is contained in:
Bas Brands 2021-09-20 11:53:23 +02:00
parent 5958c0df0c
commit f2ddd23ec1
44 changed files with 319 additions and 158 deletions

View file

@ -364,7 +364,7 @@ function assign_update_events($assign, $override = null) {
* Return the list if Moodle features this module supports
*
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function assign_supports($feature) {
switch($feature) {
@ -392,6 +392,8 @@ function assign_supports($feature) {
return true;
case FEATURE_COMMENT:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_ASSESSMENT;
default:
return null;

View file

@ -83,11 +83,12 @@ function assignment_delete_instance($id){
/**
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function assignment_supports($feature) {
switch($feature) {
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_ASSESSMENT;
default: return null;
}

View file

@ -301,7 +301,7 @@ function book_get_post_actions() {
* Supported features
*
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function book_supports($feature) {
switch($feature) {
@ -314,6 +314,7 @@ function book_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -1244,7 +1244,7 @@ function chat_reset_userdata($data) {
/**
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function chat_supports($feature) {
switch($feature) {
@ -1264,6 +1264,8 @@ function chat_supports($feature) {
return true;
case FEATURE_SHOW_DESCRIPTION:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_COMMUNICATION;
default:
return null;
}

View file

@ -836,7 +836,7 @@ function choice_get_response_data($choice, $cm, $groupmode, $onlyactive) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function choice_supports($feature) {
switch($feature) {
@ -849,6 +849,7 @@ function choice_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COMMUNICATION;
default: return null;
}

View file

@ -3029,7 +3029,7 @@ function data_get_extra_capabilities() {
/**
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function data_supports($feature) {
switch($feature) {
@ -3044,6 +3044,7 @@ function data_supports($feature) {
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_COMMENT: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COLLABORATION;
default: return null;
}

View file

@ -52,7 +52,7 @@ require_once(__DIR__ . '/deprecatedlib.php');
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function feedback_supports($feature) {
switch($feature) {
@ -65,6 +65,7 @@ function feedback_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COMMUNICATION;
default: return null;
}

View file

@ -33,7 +33,7 @@ define('FOLDER_DISPLAY_INLINE', 1);
/**
* List of features supported in Folder module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function folder_supports($feature) {
switch($feature) {
@ -46,6 +46,7 @@ function folder_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -354,7 +354,7 @@ function forum_delete_instance($id) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature
* @return mixed True if yes (some features may use other values)
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function forum_supports($feature) {
switch($feature) {
@ -370,6 +370,7 @@ function forum_supports($feature) {
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_PLAGIARISM: return true;
case FEATURE_ADVANCED_GRADING: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COLLABORATION;
default: return null;
}

View file

@ -3079,7 +3079,7 @@ function glossary_get_extra_capabilities() {
/**
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function glossary_supports($feature) {
switch($feature) {
@ -3094,6 +3094,7 @@ function glossary_supports($feature) {
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_COMMENT: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COLLABORATION;
default: return null;
}

View file

@ -41,9 +41,9 @@ use mod_h5pactivity\local\grader;
* @uses FEATURE_GRADE_OUTCOMES
* @uses FEATURE_BACKUP_MOODLE2
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function h5pactivity_supports(string $feature): ?bool {
function h5pactivity_supports(string $feature) {
switch($feature) {
case FEATURE_GROUPS:
return true;
@ -63,6 +63,8 @@ function h5pactivity_supports(string $feature): ?bool {
return true;
case FEATURE_BACKUP_MOODLE2:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_CONTENT;
default:
return null;
}

View file

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
/**
* List of features supported in IMS CP module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function imscp_supports($feature) {
switch($feature) {
@ -40,6 +40,7 @@ function imscp_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -172,7 +172,7 @@ function label_reset_userdata($data) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return bool|null True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function label_supports($feature) {
switch($feature) {
@ -186,6 +186,7 @@ function label_supports($feature) {
case FEATURE_MOD_ARCHETYPE: return MOD_ARCHETYPE_RESOURCE;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_NO_VIEW_LINK: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -981,7 +981,7 @@ function lesson_reset_userdata($data) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function lesson_supports($feature) {
switch($feature) {
@ -1003,6 +1003,8 @@ function lesson_supports($feature) {
return true;
case FEATURE_SHOW_DESCRIPTION:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_CONTENT;
default:
return null;
}

View file

@ -51,7 +51,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in URL module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function lti_supports($feature) {
switch ($feature) {
@ -65,6 +65,8 @@ function lti_supports($feature) {
case FEATURE_BACKUP_MOODLE2:
case FEATURE_SHOW_DESCRIPTION:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_CONTENT;
default:
return null;
@ -281,7 +283,8 @@ function lti_get_course_content_items(\core_course\local\entity\content_item $de
$defaultmodulecontentitem->get_icon(),
$defaultmodulecontentitem->get_help(),
$defaultmodulecontentitem->get_archetype(),
$defaultmodulecontentitem->get_component_name()
$defaultmodulecontentitem->get_component_name(),
$defaultmodulecontentitem->get_purpose()
)];
}
@ -308,7 +311,8 @@ function lti_get_course_content_items(\core_course\local\entity\content_item $de
$preconfiguredtool->icon,
$preconfiguredtool->help,
$defaultmodulecontentitem->get_archetype(),
$defaultmodulecontentitem->get_component_name()
$defaultmodulecontentitem->get_component_name(),
$defaultmodulecontentitem->get_purpose()
);
}
return $types;
@ -333,7 +337,8 @@ function mod_lti_get_all_content_items(\core_course\local\entity\content_item $d
$defaultmodulecontentitem->get_icon(),
$defaultmodulecontentitem->get_help(),
$defaultmodulecontentitem->get_archetype(),
$defaultmodulecontentitem->get_component_name()
$defaultmodulecontentitem->get_component_name(),
$defaultmodulecontentitem->get_purpose()
)];
foreach (lti_get_lti_types() as $ltitype) {
@ -368,7 +373,8 @@ function mod_lti_get_all_content_items(\core_course\local\entity\content_item $d
$type->icon,
$type->help,
$defaultmodulecontentitem->get_archetype(),
$defaultmodulecontentitem->get_component_name()
$defaultmodulecontentitem->get_component_name(),
$defaultmodulecontentitem->get_purpose()
);
}

View file

@ -404,7 +404,8 @@ class mod_lti_lib_testcase extends advanced_testcase {
'icon',
'Description of the module',
MOD_ARCHETYPE_OTHER,
'mod_lti'
'mod_lti',
MOD_PURPOSE_CONTENT
);
// The lti_get_lti_types_by_course method (used by the callbacks) assumes the global user.

View file

@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in Page module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function page_supports($feature) {
switch($feature) {
@ -39,6 +39,7 @@ function page_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -1672,7 +1672,7 @@ function quiz_attempt_summary_link_to_reports($quiz, $cm, $context, $returnzero
/**
* @param string $feature FEATURE_xx constant for requested feature
* @return bool True if quiz supports feature
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function quiz_supports($feature) {
switch($feature) {
@ -1688,6 +1688,7 @@ function quiz_supports($feature) {
case FEATURE_CONTROLS_GRADE_VISIBILITY: return true;
case FEATURE_USES_QUESTIONS: return true;
case FEATURE_PLAGIARISM: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_ASSESSMENT;
default: return null;
}

View file

@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in Resource module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function resource_supports($feature) {
switch($feature) {
@ -39,6 +39,7 @@ function resource_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}
@ -217,7 +218,6 @@ function resource_get_coursemodule_info($coursemodule) {
}
if ($resource->tobemigrated) {
$info->icon ='i/invalid';
return $info;
}
@ -226,7 +226,6 @@ function resource_get_coursemodule_info($coursemodule) {
$files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false, 0, 0, 1);
if (count($files) >= 1) {
$mainfile = reset($files);
$info->icon = file_file_icon($mainfile, 24);
$resource->mainfile = $mainfile->get_filename();
}

View file

@ -143,13 +143,11 @@ class mod_resource_lib_testcase extends advanced_testcase {
$info = resource_get_coursemodule_info(
$DB->get_record('course_modules', array('id' => $resource2->cmid)));
$this->assertEquals('R2', $info->name);
$this->assertEquals('f/text-24', $info->icon);
// For third one, it should use the highest sortorder icon.
$info = resource_get_coursemodule_info(
$DB->get_record('course_modules', array('id' => $resource3->cmid)));
$this->assertEquals('R3', $info->name);
$this->assertEquals('f/document-24', $info->icon);
}
public function test_resource_core_calendar_provide_event_action() {

View file

@ -1027,7 +1027,7 @@ function scorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedownlo
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function scorm_supports($feature) {
switch($feature) {
@ -1040,6 +1040,7 @@ function scorm_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return true;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -782,7 +782,7 @@ function survey_reset_userdata($data) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function survey_supports($feature) {
switch($feature) {
@ -795,6 +795,7 @@ function survey_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_COMMUNICATION;
default: return null;
}

View file

@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in URL module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function url_supports($feature) {
switch($feature) {
@ -41,6 +41,7 @@ function url_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}

View file

@ -258,7 +258,7 @@ function wiki_reset_course_form_definition(&$mform) {
* @uses FEATURE_GRADE_HAS_GRADE
* @uses FEATURE_GRADE_OUTCOMES
* @param string $feature
* @return mixed True if yes (some features may use other values)
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function wiki_supports($feature) {
switch ($feature) {
@ -282,6 +282,8 @@ function wiki_supports($feature) {
return true;
case FEATURE_COMMENT:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_COLLABORATION;
default:
return null;

View file

@ -47,7 +47,7 @@ define('WORKSHOP_SUBMISSION_TYPE_REQUIRED', 2);
*
* @see plugin_supports() in lib/moodlelib.php
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed true if the feature is supported, null if unknown
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function workshop_supports($feature) {
switch($feature) {
@ -60,6 +60,7 @@ function workshop_supports($feature) {
return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_PLAGIARISM: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_ASSESSMENT;
default: return null;
}
}