Skip to content

Commit

Permalink
Support Moodle ≥ 4.0 activity chooser purpose color.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed May 16, 2023
1 parent 51fe874 commit 49fe8c0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,20 @@ function capquiz_reset_gradebook($courseid, $type = '') {
}
}


// Ugly hack to make 3.11 and 4.0 work seamlessly.
if (!defined('FEATURE_MOD_PURPOSE')) {
define('FEATURE_MOD_PURPOSE', 'mod_purpose');
}
if (!defined('MOD_PURPOSE_ASSESSMENT')) {
define('MOD_PURPOSE_ASSESSMENT', 'assessment');
}

/**
* Checks if $feature is supported
*
* @param string $feature
* @return bool
* @return mixed
*/
function capquiz_supports($feature) {
switch ($feature) {
Expand All @@ -252,7 +261,10 @@ function capquiz_supports($feature) {
case FEATURE_USES_QUESTIONS:
case FEATURE_GRADE_HAS_GRADE:
return true;
case FEATURE_MOD_PURPOSE:
return MOD_PURPOSE_ASSESSMENT;
default:
return false;
}
}

0 comments on commit 49fe8c0

Please sign in to comment.