From a871329669a4f2471a376fca73e8b4224e21029f Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 12:57:55 -0700 Subject: [PATCH 01/11] add workflow file to put this plugin into a CI pipeline. --- .github/workflows/ci.yml | 115 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ee339a1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,115 @@ +name: Moodle Plugin CI + +on: + push: + pull_request: + schedule: + - cron: '33 2 * * 1' # weekly, on Monday morning + +jobs: + test: + runs-on: ubuntu-latest + + services: + mariadb: + image: mariadb:10 + env: + MYSQL_USER: 'root' + MYSQL_ALLOW_EMPTY_PASSWORD: "true" + MYSQL_CHARACTER_SET_SERVER: "utf8mb4" + MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 + + strategy: + fail-fast: false + matrix: + include: + - php: '8.2' + moodle-branch: 'main' + database: 'mariadb' + - php: '8.2' + moodle-branch: 'MOODLE_403_STABLE' + database: 'mariadb' + - php: '8.1' + moodle-branch: 'MOODLE_402_STABLE' + database: 'mariadb' + - php: '8.1' + moodle-branch: 'MOODLE_401_STABLE' + database: 'mariadb' + steps: + - name: Check out repository code + uses: actions/checkout@v3 + with: + path: plugin + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ matrix.extensions }} + ini-values: max_input_vars=5000 + # If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug". + # If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems). + coverage: none + + - name: Initialise moodle-plugin-ci + run: | + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 + echo $(cd ci/bin; pwd) >> $GITHUB_PATH + echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH + sudo locale-gen en_AU.UTF-8 + echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV + + - name: Install moodle-plugin-ci + run: | + moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + env: + DB: ${{ matrix.database }} + MOODLE_BRANCH: ${{ matrix.moodle-branch }} + + - name: PHP Lint + if: ${{ !cancelled() }} + run: moodle-plugin-ci phplint + + - name: PHP Mess Detector + continue-on-error: true # This step will show errors but will not fail + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpmd + + - name: Moodle Code Checker + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpcs --max-warnings 0 + + - name: Moodle PHPDoc Checker + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpdoc --max-warnings 0 + + - name: Validating + if: ${{ !cancelled() }} + run: moodle-plugin-ci validate + + - name: Check upgrade savepoints + if: ${{ !cancelled() }} + run: moodle-plugin-ci savepoints + + - name: Mustache Lint + if: ${{ !cancelled() }} + run: moodle-plugin-ci mustache + + - name: Grunt + if: ${{ !cancelled() }} + run: moodle-plugin-ci grunt --max-lint-warnings 0 + + - name: PHPUnit tests + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpunit --fail-on-warning + + - name: Behat features + if: ${{ !cancelled() }} + run: moodle-plugin-ci behat --profile chrome + + - name: Mark cancelled jobs as failed. + if: ${{ cancelled() }} + run: exit 1 \ No newline at end of file From 2225e7bfcabd1e28fc90ab1af1a5b58982e5e805 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 12:59:36 -0700 Subject: [PATCH 02/11] add config file for PHP CodeSniffer. --- .phpcs.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .phpcs.xml diff --git a/.phpcs.xml b/.phpcs.xml new file mode 100644 index 0000000..2c248fc --- /dev/null +++ b/.phpcs.xml @@ -0,0 +1,4 @@ + + + + From b9e8d24aa9247be4d441932b39b48a93a7fcd5d0 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 13:05:12 -0700 Subject: [PATCH 03/11] auto-fix PHPCS violations. --- ...ckup_qtype_knowledgecheck_plugin.class.php | 6 ++-- ...tore_qtype_knowledgecheck_plugin.class.php | 6 ++-- edit_knowledgecheck_form.php | 10 +++--- lang/en/qtype_knowledgecheck.php | 2 +- lib.php | 2 +- question.php | 8 ++--- questiontype.php | 10 +++--- renderer.php | 35 +++++++++---------- version.php | 2 +- 9 files changed, 40 insertions(+), 41 deletions(-) diff --git a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php index 156953d..fd39be2 100644 --- a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * @package knowledgecheck + * @package qtype_knowledgecheck * @subpackage backup-moodle2 * @copyright 2016 The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -52,14 +52,14 @@ protected function define_question_plugin_structure() { $this->add_question_question_answers($pluginwrapper); // Now create the qtype own structures. - $knowledgecheck = new backup_nested_element('knowledgecheck', array('id'), array('responsetemplate')); + $knowledgecheck = new backup_nested_element('knowledgecheck', ['id'], ['responsetemplate']); // Now the own qtype tree. $pluginwrapper->add_child($knowledgecheck); // Set source to populate the data. $knowledgecheck->set_source_table('qtype_knowledgecheck_options', - array('questionid' => backup::VAR_PARENTID)); + ['questionid' => backup::VAR_PARENTID]); // Don't need to annotate ids nor files. diff --git a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php index 3792649..6deba78 100644 --- a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * @package knowledgecheck + * @package qtype_knowledgecheck * @subpackage backup-moodle2 * @copyright 2016 The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -39,7 +39,7 @@ class restore_qtype_knowledgecheck_plugin extends restore_qtype_plugin { */ protected function define_question_plugin_structure() { - $paths = array(); + $paths = []; // This qtype uses question_answers, add them. $this->add_question_question_answers($paths); @@ -79,7 +79,7 @@ public function process_knowledgecheck($data) { // It is possible for old backup files to contain unique key violations. // We need to check to avoid that. - if (!$DB->record_exists('qtype_knowledgecheck_options', array('questionid' => $data->questionid))) { + if (!$DB->record_exists('qtype_knowledgecheck_options', ['questionid' => $data->questionid])) { $newitemid = $DB->insert_record('qtype_knowledgecheck_options', $data); $this->set_mapping('qtype_knowledgecheck_options', $oldid, $newitemid); } diff --git a/edit_knowledgecheck_form.php b/edit_knowledgecheck_form.php index 8477172..a0a6a76 100644 --- a/edit_knowledgecheck_form.php +++ b/edit_knowledgecheck_form.php @@ -17,7 +17,7 @@ /** * Defines the editing form for the knowledge check question type. * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California @@ -39,10 +39,10 @@ class qtype_knowledgecheck_edit_form extends question_edit_form { protected function definition_inner($mform) { $mform->addElement('editor', 'responsetemplate', get_string('responsetemplate', 'qtype_knowledgecheck'), - array('rows' => 10), array_merge($this->editoroptions, array('maxfiles' => 0))); + ['rows' => 10], array_merge($this->editoroptions, ['maxfiles' => 0])); $mform->addHelpButton('responsetemplate', 'responsetemplate', 'qtype_knowledgecheck'); $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_knowledgecheck', '{no}'), - array('1.0' => '100%'), 1, 0); + ['1.0' => '100%'], 1, 0); } protected function data_preprocessing($question) { @@ -53,10 +53,10 @@ protected function data_preprocessing($question) { if (empty($question->options)) { return $question; } - $question->responsetemplate = array( + $question->responsetemplate = [ 'text' => $question->options->responsetemplate, 'format' => 1, - ); + ]; return $question; } diff --git a/lang/en/qtype_knowledgecheck.php b/lang/en/qtype_knowledgecheck.php index d626d6f..a510c2f 100644 --- a/lang/en/qtype_knowledgecheck.php +++ b/lang/en/qtype_knowledgecheck.php @@ -17,7 +17,7 @@ /** * Strings for component 'qtype_knowledgecheck', language 'en', branch 'MOODLE_20_STABLE' * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California diff --git a/lib.php b/lib.php index eba5a14..b4cd614 100644 --- a/lib.php +++ b/lib.php @@ -41,7 +41,7 @@ * @param array $options additional options affecting the file serving * @return bool */ -function qtype_knowledgecheck_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { +function qtype_knowledgecheck_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { global $DB, $CFG; require_once($CFG->libdir . '/questionlib.php'); question_pluginfile($course, $context, 'qtype_knowledgecheck', $filearea, $args, $forcedownload, $options); diff --git a/question.php b/question.php index f7b7587..2983422 100644 --- a/question.php +++ b/question.php @@ -17,7 +17,7 @@ /** * Knowledge check question definition class. * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California @@ -50,14 +50,14 @@ class qtype_knowledgecheck_question extends question_graded_by_strategy /** * @var question_answer[] */ - public $answers = array(); + public $answers = []; public function __construct() { parent::__construct(new question_first_matching_answer_grading_strategy($this)); } public function get_expected_data() { - return array('answer' => PARAM_RAW_TRIMMED); + return ['answer' => PARAM_RAW_TRIMMED]; } public function summarise_response(array $response) { @@ -99,7 +99,7 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) { if ($component == 'question' && $filearea == 'answerfeedback') { $currentanswer = $qa->get_last_qt_var('answer'); - $answer = $this->get_matching_answer(array('answer' => $currentanswer)); + $answer = $this->get_matching_answer(['answer' => $currentanswer]); $answerid = reset($args); // Itemid is answer id. return $options->feedback && $answer && $answerid == $answer->id; diff --git a/questiontype.php b/questiontype.php index 9e6e0ef..fe37446 100644 --- a/questiontype.php +++ b/questiontype.php @@ -17,7 +17,7 @@ /** * Question type class for the knowledge check question type. * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California @@ -53,7 +53,7 @@ protected function delete_files($questionid, $contextid) { public function save_question_options($question) { global $DB; - $options = $DB->get_record('qtype_knowledgecheck_options', array('questionid' => $question->id)); + $options = $DB->get_record('qtype_knowledgecheck_options', ['questionid' => $question->id]); if (!$options) { $options = new stdClass(); $options->questionid = $question->id; @@ -77,7 +77,7 @@ public function get_random_guess_score($questiondata) { } public function get_possible_responses($questiondata) { - $responses = array(); + $responses = []; foreach ($questiondata->options->answers as $aid => $answer) { $responses[$aid] = new question_possible_response($answer->answer, $answer->fraction); @@ -86,11 +86,11 @@ public function get_possible_responses($questiondata) { $responses[0] = new question_possible_response(get_string('didnotmatchanyanswer', 'question'), 0); $responses[null] = question_possible_response::no_response(); - return array($questiondata->id => $responses); + return [$questiondata->id => $responses]; } public function extra_question_fields() { - return array('qtype_knowledgecheck_options', 'responsetemplate'); + return ['qtype_knowledgecheck_options', 'responsetemplate']; } public function is_real_question_type() { diff --git a/renderer.php b/renderer.php index 2095361..4a5e3ef 100644 --- a/renderer.php +++ b/renderer.php @@ -17,7 +17,7 @@ /** * Knowledge check question renderer class. * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California @@ -46,10 +46,9 @@ public function formulation_and_controls(question_attempt $qa, // Answer field. $step = $qa->get_last_step_with_qt_var('answer'); - if (!$step->has_qt_var('answer') && empty($options->readonly)) { // Question has never been answered, fill it with response template. - $step = new question_attempt_step(array('answer'=>$question->responsetemplate)); + $step = new question_attempt_step(['answer' => $question->responsetemplate]); } if (empty($options->readonly)) { @@ -63,16 +62,16 @@ public function formulation_and_controls(question_attempt $qa, $result = ''; $result .= html_writer::tag('div', $question->format_questiontext($qa), - array('class' => 'qtext')); + ['class' => 'qtext']); - $result .= html_writer::start_tag('div', array('class' => 'ablock')); - $result .= html_writer::tag('div', $answer, array('class' => 'answer')); + $result .= html_writer::start_tag('div', ['class' => 'ablock']); + $result .= html_writer::tag('div', $answer, ['class' => 'answer']); $result .= html_writer::end_tag('div'); if ($qa->get_state() == question_state::$invalid) { $result .= html_writer::nonempty_tag('div', - $question->get_validation_error(array('answer' => $answer)), - array('class' => 'validationerror')); + $question->get_validation_error(['answer' => $answer]), + ['class' => 'validationerror']); } return $result; @@ -81,7 +80,7 @@ public function formulation_and_controls(question_attempt $qa, public function specific_feedback(question_attempt $qa) { $question = $qa->get_question(); - $answer = $question->get_matching_answer(array('answer' => $qa->get_last_qt_var('answer'))); + $answer = $question->get_matching_answer(['answer' => $qa->get_last_qt_var('answer')]); if (!$answer || !$answer->feedback) { return ''; } @@ -108,7 +107,7 @@ protected function class_name() { public function response_area_read_only($name, $qa, $step, $lines, $context) { return html_writer::tag('div', $this->prepare_response($name, $qa, $step, $context), - array('class' => $this->class_name() . ' qtype_knowledgecheck_editor readonly')); + ['class' => $this->class_name() . ' qtype_knowledgecheck_editor readonly']); } public function response_area_input($name, $qa, $step, $lines, $context) { @@ -133,17 +132,17 @@ public function response_area_input($name, $qa, $step, $lines, $context) { $this->get_filepicker_options($context, $draftitemid)); $output = ''; - $output .= html_writer::start_tag('div', array('class' => - $this->class_name() . ' qtype_knowledgecheck_response')); + $output .= html_writer::start_tag('div', ['class' => + $this->class_name() . ' qtype_knowledgecheck_response']); $output .= html_writer::tag('div', html_writer::tag('textarea', s($response), - array('id' => $id, 'name' => $inputname, 'rows' => $lines, 'cols' => 60))); + ['id' => $id, 'name' => $inputname, 'rows' => $lines, 'cols' => 60])); $output .= html_writer::start_tag('div'); if (count($formats) == 1) { reset($formats); - $output .= html_writer::empty_tag('input', array('type' => 'hidden', - 'name' => $inputname . 'format', 'value' => key($formats))); + $output .= html_writer::empty_tag('input', ['type' => 'hidden', + 'name' => $inputname . 'format', 'value' => key($formats)]); } else { $output .= html_writer::label(get_string('format'), 'menu' . $inputname . 'format', false); @@ -187,7 +186,7 @@ protected function prepare_response($name, question_attempt $qa, */ protected function prepare_response_for_editing($name, question_attempt_step $step, $context) { - return array(0, $step->get_qt_var($name)); + return [0, $step->get_qt_var($name)]; } /** @@ -195,7 +194,7 @@ protected function prepare_response_for_editing($name, * @return array options for the editor. */ protected function get_editor_options($context) { - return array('context' => $context); + return ['context' => $context]; } /** @@ -204,7 +203,7 @@ protected function get_editor_options($context) { * @return array filepicker options for the editor. */ protected function get_filepicker_options($context, $draftitemid) { - return array('return_types' => FILE_INTERNAL | FILE_EXTERNAL); + return ['return_types' => FILE_INTERNAL | FILE_EXTERNAL]; } /** diff --git a/version.php b/version.php index 2d283eb..7969ea9 100644 --- a/version.php +++ b/version.php @@ -17,7 +17,7 @@ /** * Knowledge check question type version information. * - * @package qtype + * @package qtype_knowledgecheck * @subpackage knowledgecheck * @copyright 2016 The Regents of the University of California From 4a5cad27e69421b7c86a395b44fbd23ae7f2186a Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 13:06:18 -0700 Subject: [PATCH 04/11] fix linter warning: rm unexpected moodle internals check. --- backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php | 4 ---- backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php | 4 ---- edit_knowledgecheck_form.php | 4 ---- lib.php | 4 ---- question.php | 4 ---- 5 files changed, 20 deletions(-) diff --git a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php index fd39be2..2ab0801 100644 --- a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php @@ -21,10 +21,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - /** * Provides the information to backup knowledge check questions. * diff --git a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php index 6deba78..f241d72 100644 --- a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php @@ -21,10 +21,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - /** * restore plugin class that provides the necessary information * needed to restore one knowledgecheck qtype plugin diff --git a/edit_knowledgecheck_form.php b/edit_knowledgecheck_form.php index a0a6a76..5c1c39c 100644 --- a/edit_knowledgecheck_form.php +++ b/edit_knowledgecheck_form.php @@ -24,10 +24,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - /** * Knowledge check question editing form definition. * diff --git a/lib.php b/lib.php index b4cd614..1373049 100644 --- a/lib.php +++ b/lib.php @@ -24,10 +24,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - /** * Checks file access for knowledge check questions. * @package qtype_knowledgecheck diff --git a/question.php b/question.php index 2983422..bf64693 100644 --- a/question.php +++ b/question.php @@ -24,10 +24,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - /** * Represents a knowledge check question. * From 061aeb3095f7550e8f9f831e2e70e2b2c1f48cc4 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 13:09:07 -0700 Subject: [PATCH 05/11] fix linter warning: capitalize first letter in sentence. --- question.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/question.php b/question.php index bf64693..4085405 100644 --- a/question.php +++ b/question.php @@ -87,7 +87,7 @@ public function compare_response_with_answer(array $response, question_answer $a return false; } - // whatever the answer is - it's always correct. + // Whatever the answer is - it's always correct. return true; } From dcdca9698f7625fd1a2d386735e076886bb880c5 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 13:11:32 -0700 Subject: [PATCH 06/11] Clean up docblocks. - drop year from copyright statements - this belongs to the regents foerever and ever. - drop sub-package declarations where unnecessary. - add and remove blank lines in docblocks as applicable. - make sure that code comments are fully formed sentences. --- README.md | 2 +- .../backup_qtype_knowledgecheck_plugin.class.php | 5 +++-- .../restore_qtype_knowledgecheck_plugin.class.php | 8 ++++---- edit_knowledgecheck_form.php | 8 +++----- lang/en/qtype_knowledgecheck.php | 6 ++---- lib.php | 7 +++---- question.php | 8 +++----- questiontype.php | 9 +++------ renderer.php | 12 ++++-------- version.php | 4 +--- 10 files changed, 27 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index c3d10c0..a772433 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ A custom question type for Moodle. -Copyright (c) 2016 by The Regents of the University of California +Copyright (c) by The Regents of the University of California This is Open Source Software, published under the GPL v3 license. diff --git a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php index 2ab0801..9a0f997 100644 --- a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php @@ -17,14 +17,15 @@ /** * @package qtype_knowledgecheck * @subpackage backup-moodle2 - * @copyright 2016 The Regents of the University of California + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Provides the information to backup knowledge check questions. * - * @copyright 2016 The Regents of the University of California + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class backup_qtype_knowledgecheck_plugin extends backup_qtype_plugin { diff --git a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php index f241d72..d45a35f 100644 --- a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php @@ -17,15 +17,15 @@ /** * @package qtype_knowledgecheck * @subpackage backup-moodle2 - * @copyright 2016 The Regents of the University of California + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** - * restore plugin class that provides the necessary information - * needed to restore one knowledgecheck qtype plugin + * Restore plugin class that provides the necessary information needed to restore one knowledgecheck qtype plugin. * - * @copyright 2016 The Regents of the University of California + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_qtype_knowledgecheck_plugin extends restore_qtype_plugin { diff --git a/edit_knowledgecheck_form.php b/edit_knowledgecheck_form.php index 5c1c39c..31cfd00 100644 --- a/edit_knowledgecheck_form.php +++ b/edit_knowledgecheck_form.php @@ -18,17 +18,15 @@ * Defines the editing form for the knowledge check question type. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Knowledge check question editing form definition. * - * @copyright 2016 The Regents of the University of California - + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_edit_form extends question_edit_form { diff --git a/lang/en/qtype_knowledgecheck.php b/lang/en/qtype_knowledgecheck.php index a510c2f..04a1c5d 100644 --- a/lang/en/qtype_knowledgecheck.php +++ b/lang/en/qtype_knowledgecheck.php @@ -15,12 +15,10 @@ // along with Moodle. If not, see . /** - * Strings for component 'qtype_knowledgecheck', language 'en', branch 'MOODLE_20_STABLE' + * Strings for component 'qtype_knowledgecheck'. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['answerno'] = 'Answer {$a}'; diff --git a/lib.php b/lib.php index 1373049..6ad750f 100644 --- a/lib.php +++ b/lib.php @@ -15,17 +15,16 @@ // along with Moodle. If not, see . /** - * Serve question type files + * Serve question type files. * - * @since 2.0 * @package qtype_knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Checks file access for knowledge check questions. + * * @package qtype_knowledgecheck * @category files * @param stdClass $course course object diff --git a/question.php b/question.php index 4085405..5ab335b 100644 --- a/question.php +++ b/question.php @@ -18,17 +18,15 @@ * Knowledge check question definition class. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Represents a knowledge check question. * - * @copyright 2016 The Regents of the University of California - + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_question extends question_graded_by_strategy diff --git a/questiontype.php b/questiontype.php index fe37446..687ef45 100644 --- a/questiontype.php +++ b/questiontype.php @@ -18,13 +18,10 @@ * Question type class for the knowledge check question type. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/questionlib.php'); @@ -35,8 +32,8 @@ /** * The knowledge check question type. * - * @copyright 2016 The Regents of the University of California - + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck extends question_type { diff --git a/renderer.php b/renderer.php index 4a5e3ef..046b011 100644 --- a/renderer.php +++ b/renderer.php @@ -18,21 +18,17 @@ * Knowledge check question renderer class. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - defined('MOODLE_INTERNAL') || die(); - /** * Generates the output for knowledge check questions. * - * @copyright 2016 The Regents of the University of California - + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_renderer extends qtype_renderer { @@ -97,7 +93,7 @@ public function specific_feedback(question_attempt $qa) { * * Copied and modified from the Essay question type for our purposes. * - * @copyright 2016 The Regents of the University of California + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_format_editor_renderer extends plugin_renderer_base { diff --git a/version.php b/version.php index 7969ea9..cfd3ef1 100644 --- a/version.php +++ b/version.php @@ -18,9 +18,7 @@ * Knowledge check question type version information. * * @package qtype_knowledgecheck - * @subpackage knowledgecheck - * @copyright 2016 The Regents of the University of California - + * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ From ba596fee4e26ab6c0db85194066b4bda9d1ac13c Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 14:47:38 -0700 Subject: [PATCH 07/11] adds and updates class/method docblocks as applicable. most of it is moot, but PHPdoc is very pendantic about this, so i've added the least amount of docs necessary here. Most of it has been copied from whatever base class these methods were inherited from. --- ...ckup_qtype_knowledgecheck_plugin.class.php | 4 +- ...tore_qtype_knowledgecheck_plugin.class.php | 3 + edit_knowledgecheck_form.php | 16 ++++++ question.php | 57 +++++++++++++++++++ questiontype.php | 53 +++++++++++++++++ renderer.php | 53 ++++++++++++++++- 6 files changed, 182 insertions(+), 4 deletions(-) diff --git a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php index 9a0f997..f65ddde 100644 --- a/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/backup_qtype_knowledgecheck_plugin.class.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Backup plugin for the Knowledge check question type. + * * @package qtype_knowledgecheck * @subpackage backup-moodle2 * @copyright (c) The Regents of the University of California @@ -22,7 +24,7 @@ */ /** - * Provides the information to backup knowledge check questions. + * Provides the information to backup knowledgecheck questions. * * @package qtype_knowledgecheck * @copyright (c) The Regents of the University of California diff --git a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php index d45a35f..bdbbf15 100644 --- a/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php +++ b/backup/moodle2/restore_qtype_knowledgecheck_plugin.class.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Restore plugin for the Knowledge check question type. + * * @package qtype_knowledgecheck * @subpackage backup-moodle2 * @copyright (c) The Regents of the University of California @@ -51,6 +53,7 @@ protected function define_question_plugin_structure() { /** * Process the qtype/knowledgecheck element + * @param array $data The data to restore. */ public function process_knowledgecheck($data) { global $DB; diff --git a/edit_knowledgecheck_form.php b/edit_knowledgecheck_form.php index 31cfd00..001af3d 100644 --- a/edit_knowledgecheck_form.php +++ b/edit_knowledgecheck_form.php @@ -31,6 +31,11 @@ */ class qtype_knowledgecheck_edit_form extends question_edit_form { + /** + * {@inheritdoc} + * + * @param object $mform The form being built. + */ protected function definition_inner($mform) { $mform->addElement('editor', 'responsetemplate', get_string('responsetemplate', 'qtype_knowledgecheck'), ['rows' => 10], array_merge($this->editoroptions, ['maxfiles' => 0])); @@ -39,6 +44,12 @@ protected function definition_inner($mform) { ['1.0' => '100%'], 1, 0); } + /** + * {@inheritdoc} + * + * @param object $question The data being passed to the form. + * @return object $question The modified data. + */ protected function data_preprocessing($question) { $question = parent::data_preprocessing($question); $question = $this->data_preprocessing_answers($question); @@ -55,6 +66,11 @@ protected function data_preprocessing($question) { return $question; } + /** + * {@inheritdoc} + * + * @return string The question type name. + */ public function qtype() { return 'knowledgecheck'; } diff --git a/question.php b/question.php index 5ab335b..8df090c 100644 --- a/question.php +++ b/question.php @@ -46,14 +46,28 @@ class qtype_knowledgecheck_question extends question_graded_by_strategy */ public $answers = []; + /** + * {@inheritdoc} + */ public function __construct() { parent::__construct(new question_first_matching_answer_grading_strategy($this)); } + /** + * {@inheritdoc} + * + * @return array A structure defining what data is expected in the response to this question. + */ public function get_expected_data() { return ['answer' => PARAM_RAW_TRIMMED]; } + /** + * {@inheritdoc} + * + * @param array $response A given response. + * @return string|null A plain text summary of that response, that could be used in reports. + */ public function summarise_response(array $response) { if (isset($response['answer'])) { return $response['answer']; @@ -62,24 +76,56 @@ public function summarise_response(array $response) { } } + /** + * {@inheritdoc} + * + * @param array $response A list of responses. + * @return bool whether this response is a complete answer to this question. + */ public function is_complete_response(array $response) { return array_key_exists('answer', $response) && ($response['answer'] || $response['answer'] === '0'); } + /** + * {@inheritdoc} + * + * @param array $response The given response + * @return string the validation error message. + */ public function get_validation_error(array $response) { return get_string('pleaseenterananswer', 'qtype_knowledgecheck'); } + /** + * {@inheritdoc} + * + * @param array $prevresponse the responses previously recorded for this question. + * @param array $newresponse the new responses, in the same format. + * @return bool whether the two sets of responses are the same - that is + * whether the new set of responses can safely be discarded. + */ public function is_same_response(array $prevresponse, array $newresponse) { return question_utils::arrays_same_at_key_missing_is_blank( $prevresponse, $newresponse, 'answer'); } + /** + * Returns a list of possible answers to this question. + * + * @return array A list of possible answers to this question. + */ public function get_answers() { return $this->answers; } + /** + * Compares the given response with a given possible answer. + * + * @param array $response the response. + * @param question_answer $answer an answer. + * @return bool whether the response matches the answer. + */ public function compare_response_with_answer(array $response, question_answer $answer) { if (!array_key_exists('answer', $response) || is_null($response['answer'])) { return false; @@ -89,6 +135,17 @@ public function compare_response_with_answer(array $response, question_answer $a return true; } + /** + * {@inheritdoc} + * + * @param question_attempt $qa the question attempt being displayed. + * @param question_display_options $options the options that control display of the question. + * @param string $component the name of the component we are serving files for. + * @param string $filearea the name of the file area. + * @param array $args the remaining bits of the file path. + * @param bool $forcedownload whether the user must be forced to download the file. + * @return bool true if the user can access this file. + */ public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) { if ($component == 'question' && $filearea == 'answerfeedback') { diff --git a/questiontype.php b/questiontype.php index 687ef45..90f9f04 100644 --- a/questiontype.php +++ b/questiontype.php @@ -38,16 +38,36 @@ */ class qtype_knowledgecheck extends question_type { + /** + * {@inheritdoc} + * + * @param int $questionid the question being moved. + * @param int $oldcontextid the context it is moving from. + * @param int $newcontextid the context it is moving to. + */ public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_hints($questionid, $oldcontextid, $newcontextid); } + /** + * {@inheritdoc} + * + * @param int $questionid the question being deleted. + * @param int $contextid the context the question is in. + */ protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_hints($questionid, $contextid); } + /** + * {@inheritdoc} + * + * @param object $question This holds the information from the editing form, + * it is not a standard question object. + * @return object $result->error or $result->notice + */ public function save_question_options($question) { global $DB; $options = $DB->get_record('qtype_knowledgecheck_options', ['questionid' => $question->id]); @@ -63,16 +83,37 @@ public function save_question_options($question) { $this->save_hints($question); } + /** + * {@inheritdoc} + * + * @param question_definition $question the question_definition we are creating. + * @param object $questiondata the question data loaded from the database. + */ protected function initialise_question_instance(question_definition $question, $questiondata) { parent::initialise_question_instance($question, $questiondata); $this->initialise_question_answers($question, $questiondata); } + /** + * {@inheritdoc} + * + * @param stdClass $questiondata data defining a question, as returned by + * question_bank::load_question_data(). + * @return number|null either a fraction estimating what the student would + * score by guessing, or null, if it is not possible to estimate. + */ public function get_random_guess_score($questiondata) { return 0; } + /** + * {@inheritdoc} + * + * @param object $questiondata the question definition data. + * @return array keys are subquestionid, values are arrays of possible + * responses to that subquestion. + */ public function get_possible_responses($questiondata) { $responses = []; @@ -86,10 +127,22 @@ public function get_possible_responses($questiondata) { return [$questiondata->id => $responses]; } + /** + * {@inheritdoc} + * + * @return mixed array as above, or null to tell the base class to do nothing. + */ public function extra_question_fields() { return ['qtype_knowledgecheck_options', 'responsetemplate']; } + /** + * {@inheritdoc} + * + * @return bool override this to return false if this is not really a + * question type, for example the description question type is not + * really a question type. + */ public function is_real_question_type() { return false; } diff --git a/renderer.php b/renderer.php index 046b011..3a5ffc4 100644 --- a/renderer.php +++ b/renderer.php @@ -32,6 +32,14 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_renderer extends qtype_renderer { + + /** + * {@inheritdoc} + * + * @param question_attempt $qa the question attempt to display. + * @param question_display_options $options controls what should and should not be displayed. + * @return string HTML fragment. + */ public function formulation_and_controls(question_attempt $qa, question_display_options $options) { @@ -73,6 +81,12 @@ public function formulation_and_controls(question_attempt $qa, return $result; } + /** + * {@inheritdoc} + * + * @param question_attempt $qa the question attempt to display. + * @return string HTML fragment. + */ public function specific_feedback(question_attempt $qa) { $question = $qa->get_question(); @@ -86,26 +100,51 @@ public function specific_feedback(question_attempt $qa) { } } - /** - * A format renderer for knowledge checks where the student should use the HTML - * editor without the file picker. + * A format renderer for knowledge checks where the student should use the HTML editor without the file picker. * * Copied and modified from the Essay question type for our purposes. * + * @package qtype_knowledgecheck * @copyright (c) The Regents of the University of California * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_knowledgecheck_format_editor_renderer extends plugin_renderer_base { + + /** + * Gets a specific class name to add to the input element. + * + * @return string specific class name to add to the input element. + */ protected function class_name() { return 'qtype_knowledgecheck_editor'; } + /** + * Render the student's response when the question is in read-only mode. + * + * @param string $name the variable name this input edits. + * @param question_attempt $qa the question attempt being display. + * @param question_attempt_step $step the current step. + * @param int $lines approximate size of input box to display. + * @param object $context the context teh output belongs to. + * @return string html to display the response. + */ public function response_area_read_only($name, $qa, $step, $lines, $context) { return html_writer::tag('div', $this->prepare_response($name, $qa, $step, $context), ['class' => $this->class_name() . ' qtype_knowledgecheck_editor readonly']); } + /** + * Render the student's response when the question is in read-only mode. + * + * @param string $name the variable name this input edits. + * @param question_attempt $qa the question attempt being display. + * @param question_attempt_step $step the current step. + * @param int $lines approximate size of input box to display. + * @param object $context the context teh output belongs to. + * @return string html to display the response for editing. + */ public function response_area_input($name, $qa, $step, $lines, $context) { global $CFG; require_once($CFG->dirroot . '/repository/lib.php'); @@ -155,6 +194,7 @@ public function response_area_input($name, $qa, $step, $lines, $context) { /** * Prepare the response for read-only display. + * * @param string $name the variable name this input edits. * @param question_attempt $qa the question attempt being display. * @param question_attempt_step $step the current step. @@ -175,6 +215,7 @@ protected function prepare_response($name, question_attempt $qa, /** * Prepare the response for editing. + * * @param string $name the variable name this input edits. * @param question_attempt_step $step the current step. * @param object $context the context the attempt belongs to. @@ -186,6 +227,8 @@ protected function prepare_response_for_editing($name, } /** + * Get editor options for question response text area. + * * @param object $context the context the attempt belongs to. * @return array options for the editor. */ @@ -194,6 +237,8 @@ protected function get_editor_options($context) { } /** + * Get filepicker options for the editor. + * * @param object $context the context the attempt belongs to. * @param int $draftitemid draft item id. * @return array filepicker options for the editor. @@ -203,6 +248,8 @@ protected function get_filepicker_options($context, $draftitemid) { } /** + * Get HTML for the filepicker, if used. + * * @param string $inputname input field name. * @param int $draftitemid draft file area itemid. * @return string HTML for the filepicker, if used. From be91d4ddc6466e575be9cc750c83dcda29a54564 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 14:51:47 -0700 Subject: [PATCH 08/11] rm unnecessary method override - it's the same as the overridden method. --- questiontype.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/questiontype.php b/questiontype.php index 90f9f04..6288274 100644 --- a/questiontype.php +++ b/questiontype.php @@ -95,18 +95,6 @@ protected function initialise_question_instance(question_definition $question, $ } - /** - * {@inheritdoc} - * - * @param stdClass $questiondata data defining a question, as returned by - * question_bank::load_question_data(). - * @return number|null either a fraction estimating what the student would - * score by guessing, or null, if it is not possible to estimate. - */ - public function get_random_guess_score($questiondata) { - return 0; - } - /** * {@inheritdoc} * From c94e3e16a85a772de2961ada6258c7c9cff02c95 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 15:03:29 -0700 Subject: [PATCH 09/11] adds metadata provider. --- classes/privacy/provider.php | 65 ++++++++++++++++++++++++++++++++ lang/en/qtype_knowledgecheck.php | 2 + 2 files changed, 67 insertions(+) create mode 100644 classes/privacy/provider.php diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php new file mode 100644 index 0000000..36b3cab --- /dev/null +++ b/classes/privacy/provider.php @@ -0,0 +1,65 @@ +. + +/** + * Privacy Subsystem implementation for qtype_knowledgecheck. + * + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace qtype_knowledgecheck\privacy; + +use core_privacy\local\metadata\collection; +use core_privacy\local\metadata\provider as base_provider; +use core_privacy\local\request\user_preference_provider; +use core_privacy\local\request\writer; + +/** + * Privacy Subsystem for qtype_knowledgecheck implementing user_preference_provider. + * + * @package qtype_knowledgecheck + * @copyright (c) The Regents of the University of California + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements base_provider, user_preference_provider { + + + /** + * Returns meta-data about this system. + * + * @param collection $collection The initialised collection to add items to. + * @return collection A listing of user data stored through this system. + */ + public static function get_metadata(collection $collection): collection { + $collection->add_user_preference('qtype_knowledgecheck_defaultmark', 'privacy:preference:defaultmark'); + return $collection; + } + + /** + * Export all user preferences for the plugin. + * + * @param int $userid The userid of the user whose data is to be exported. + */ + public static function export_user_preferences(int $userid) { + $preference = get_user_preferences('qtype_knowledgecheck_defaultmark', null, $userid); + if (null !== $preference) { + $desc = get_string('privacy:preference:defaultmark', 'qtype_knowledgecheck'); + writer::export_user_preference('qtype_knowledgecheck', 'defaultmark', $preference, $desc); + } + } +} diff --git a/lang/en/qtype_knowledgecheck.php b/lang/en/qtype_knowledgecheck.php index 04a1c5d..a15a3f1 100644 --- a/lang/en/qtype_knowledgecheck.php +++ b/lang/en/qtype_knowledgecheck.php @@ -28,6 +28,8 @@ $string['pluginnameadding'] = 'Adding a knowledge check question'; $string['pluginnameediting'] = 'Editing a knowledge check question'; $string['pluginnamesummary'] = 'Students can check their knowledge and get immediate or delayed feedback (depending on the question settings). All answers are automatically graded and assumed to be correct. The main purpose of this question type is to automatically provide students with feedback on their responses.'; +$string['privacy:metadata'] = 'Knowledgecheck question type plugin allows question authors to set default options as user preferences.'; +$string['privacy:preference:defaultmark'] = 'The default mark set for a given question.'; $string['responsetemplate'] = 'Response template'; $string['responsetemplate_help'] = 'Any text entered here will be displayed in the response input box when a new attempt at the question starts.'; From ab5029dbbe92baec86a0ca58647dc49b615b59ae Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 15:13:33 -0700 Subject: [PATCH 10/11] cleans up stylesheet. the style linter had a few complaints about hex-color capitalization and missing spaces before curlies. this fixed it. --- styles.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/styles.css b/styles.css index 5a2eb2e..e142055 100644 --- a/styles.css +++ b/styles.css @@ -17,11 +17,11 @@ body#page-question-type-knowledgecheck div[id^=fgroup_id_][id*=answeroptions_] { display: none; } -body#page-question-type-knowledgecheck div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label{ +body#page-question-type-knowledgecheck div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label { display: none; } -body#page-question-type-knowledgecheck div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_']{ +body#page-question-type-knowledgecheck div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_'] { display: none; } @@ -30,12 +30,12 @@ body#page-question-type-knowledgecheck div[id^=fitem_id_][id*=fraction_] { } body#page-question-type-knowledgecheck div[id^=fitem_id_][id*=feedback_] { - background: #EEE; + background: #eee; margin-bottom: 2em; margin-top: 0; padding-bottom: 5px; padding-top: 5px; - border: 1px solid #BBB; + border: 1px solid #bbb; } body#page-question-type-knowledgecheck div[id=fitem_id_addanswers] { From 56dce6118bbb4ce66280ec5e23f34dbfeda90b5f Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 16 Mar 2024 15:20:24 -0700 Subject: [PATCH 11/11] bump version, add release and support info. --- version.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/version.php b/version.php index cfd3ef1..a2f2865 100644 --- a/version.php +++ b/version.php @@ -25,6 +25,8 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'qtype_knowledgecheck'; -$plugin->version = 2022121200; -$plugin->requires = 2022111800; +$plugin->version = 2024031600; +$plugin->release = 'v4.1'; +$plugin->requires = 2022112800; +$plugin->supported = [401, 401]; $plugin->maturity = MATURITY_STABLE;