From c4a7048075a3194ca26b8c38dbaf55029c2904c9 Mon Sep 17 00:00:00 2001 From: "jacob.viertel@wunderbyte.at" Date: Wed, 21 Feb 2024 09:22:19 +0100 Subject: [PATCH] New Feature: multiple select participants db --- db/install.xml | 2 +- db/upgrade.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ mod_form.php | 2 +- version.php | 2 +- 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 db/upgrade.php diff --git a/db/install.xml b/db/install.xml index b61ff8d..a1da0c5 100644 --- a/db/install.xml +++ b/db/install.xml @@ -12,7 +12,7 @@ - + diff --git a/db/upgrade.php b/db/upgrade.php new file mode 100644 index 0000000..7c49221 --- /dev/null +++ b/db/upgrade.php @@ -0,0 +1,49 @@ +. + +/** + * Contains function with the definition of upgrade steps for the plugin. + * + * @package mod_adele + * @copyright 2024 Wunderbyte + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Defines upgrade steps for the plugin. + * + * @param mixed $oldversion + * @return bool True on success. + */ +function xmldb_adele_upgrade($oldversion) { + global $DB; + + $dbman = $DB->get_manager(); + if ($oldversion < 2024022100) { + + // Changing type of field participantslist on table adele to char. + $table = new xmldb_table('adele'); + $field = new xmldb_field('participantslist', XMLDB_TYPE_CHAR, '256', null, XMLDB_NOTNULL, null, '0', 'userlist'); + + // Launch change of type for field participantslist. + $dbman->change_field_type($table, $field); + + // Adele savepoint reached. + upgrade_mod_savepoint(true, 2024022100, 'adele'); + } + + return true; +} diff --git a/mod_form.php b/mod_form.php index 7697781..2f0781a 100644 --- a/mod_form.php +++ b/mod_form.php @@ -98,7 +98,7 @@ public function definition() { 2 => get_string('mform_options_participantslist_starting_courses', 'mod_adele'), ]; $mform->addElement('autocomplete', 'participantslist', get_string('mform_select_participantslist', 'mod_adele'), - $participantslist); + $participantslist, ['multiple' => true]); // Add standard elements. $this->standard_coursemodule_elements(); diff --git a/version.php b/version.php index 1ca8ae7..4a9a50e 100644 --- a/version.php +++ b/version.php @@ -26,6 +26,6 @@ $plugin->component = 'mod_adele'; $plugin->release = '0.1.0'; -$plugin->version = 2024011822; +$plugin->version = 2024022100; $plugin->requires = 2022112800; $plugin->maturity = MATURITY_ALPHA;