/** True if module can show description on course main page */
define('FEATURE_SHOW_DESCRIPTION', 'showdescription');
+/** True if module uses the question bank */
+define('FEATURE_USES_QUESTIONS', 'usesquestions');
+
/** Unspecified module archetype */
define('MOD_ARCHETYPE_OTHER', 0);
/** Resource-like type module */
return $types;
}
}
+
+/**
+ * Does an activity module use the question bank?
+ *
+ * @param string $modname The name of the module (without mod_ prefix).
+ * @return bool true if the module uses questions.
+ */
+function question_module_uses_questions($modname) {
+ if (plugin_supports('mod', $modname, FEATURE_USES_QUESTIONS)) {
+ return true;
+ }
+
+ $component = 'mod_'.$modname;
+ if (component_callback_exists($component, 'question_pluginfile')) {
+ debugging("{$component} uses questions but doesn't declare FEATURE_USES_QUESTIONS", DEBUG_DEVELOPER);
+ return true;
+ }
+
+ return false;
+}
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_CONTROLS_GRADE_VISIBILITY: return true;
+ case FEATURE_USES_QUESTIONS: return true;
default: return null;
}
This files describes API changes in /mod/* - activity modules,
information provided here is intended especially for developers.
+=== 2.6 ===
+
+* Modules using the question bank MUST now declare their use of it with the xxx_supports()
+ flag FEATURE_USES_QUESTIONS.
=== 2.5 ===
=== 2.6 ===
-1) It is sometimes necessary to display bits of question content without having
+1) Modules using the question bank MUST now declare their use of it with the xxx_supports()
+ flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
+ if a module uses questions.
+
+2) It is sometimes necessary to display bits of question content without having
and attempt (question_usage) in progress. Two examples of this are the option
in the question bank to display the questiontext, and in the quiz statistics
report, where it displays the question text above the report.