Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backup/moodle2/backup_checklist_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function define_structure() {
$checklist = new backup_nested_element('checklist', ['id'], [
'name', 'intro', 'introformat', 'timecreated', 'timemodified', 'useritemsallowed', 'studentcomments',
'teacheredit', 'theme', 'duedatesoncalendar', 'teachercomments', 'maxgrade',
'autopopulate', 'autoupdate', 'completionpercent', 'completionpercenttype', 'emailoncomplete', 'lockteachermarks',
'autopopulate', 'supportlabel', 'autoupdate', 'completionpercent', 'completionpercenttype', 'emailoncomplete', 'lockteachermarks',
]);

$items = new backup_nested_element('items');
Expand Down
18 changes: 18 additions & 0 deletions classes/local/output_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class output_status {
protected $itemid = null;
/** @var bool */
protected $autopopulate = false;
/** @var bool */
protected $supportlabel = false;
/** @var string|null */
protected $autoupdatewarning = null;
/** @var bool */
Expand Down Expand Up @@ -405,6 +407,22 @@ public function set_autopopulate($autopopulate) {
$this->autopopulate = $autopopulate;
}

/**
* Is label support enabled for this instance?
* @return boolean
*/
public function is_supportlabel() {
return $this->supportlabel;
}

/**
* Set as label support enabled
* @param boolean $supportlabel
*/
public function set_supportlabel($supportlabel) {
$this->supportlabel = $supportlabel;
}

/**
* Should the autoupdate warning be shown and, if so, what type?
* @return int|null
Expand Down
1 change: 1 addition & 0 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<FIELD NAME="teachercomments" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="1" SEQUENCE="false" COMMENT="Are teachers allowed to add comments to a user's checklist items?"/>
<FIELD NAME="maxgrade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false"/>
<FIELD NAME="autopopulate" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Automatically fill in the checklist, based on the modules in the current course"/>
<FIELD NAME="supportlabel" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether or not labels are supported"/>
<FIELD NAME="autoupdate" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="1" SEQUENCE="false" COMMENT="Automatically update items that are linked to course modules (tick them off when items are complete)"/>
<FIELD NAME="completionpercent" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Percentage of items that need to be checked off before the checklist is regarded as complete"/>
<FIELD NAME="completionpercenttype" TYPE="char" LENGTH="8" NOTNULL="true" DEFAULT="percent" SEQUENCE="false" COMMENT="Whether completionpercent represents a percentage or raw number of items"/>
Expand Down
12 changes: 12 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,5 +441,17 @@ function xmldb_checklist_upgrade($oldversion = 0) {
upgrade_mod_savepoint(true, 2022052801, 'checklist');
}

if ($oldversion < 2026010100) {
$table = new xmldb_table('checklist');
$field = new xmldb_field('supportlabel', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Checklist savepoint reached.
upgrade_mod_savepoint(true, 2026010100, 'checklist');

}

return $result;
}
3 changes: 3 additions & 0 deletions lang/en/checklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
$string['student_comment_updated'] = 'Student comment updated';
$string['student_comment_updated_desc'] = 'The user with id {$a->userid} has updated a comment in the checklist with course module id {$a->cmid} to have text \'{$a->commenttext}\'';
$string['studentcomments'] = 'User can add their own comments to checklist items';
$string['supportlabel'] = 'Support label';
$string['supportlabel_help'] = 'By default label are not supported because in many cases the checklist would be very large.<br />
If you whant also to use label in checklist, then you can activate it with this setting.';
$string['teacheralongsidecheck'] = 'Student and teacher';
$string['teachercomments'] = 'Teachers can add comments';
$string['teacherdate'] = 'Date a teacher last updated this item';
Expand Down
5 changes: 3 additions & 2 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,13 @@ protected function update_items_from_course() {
$nextpos = $this->items[$sectionheading]->position + 1;
}

$supportlabel = $this->checklist->supportlabel;
foreach ($sections[$section] as $cmid) {
if ($this->cm->id == $cmid) {
continue; // Do not include this checklist in the list of modules.
}
if ($mods->get_cm($cmid)->modname === 'label') {
continue; // Ignore any labels.
if ($mods->get_cm($cmid)->modname === 'label' && !$supportlabel) {
continue; // Ignore any labels.
}
if (isset($mods->get_cm($cmid)->deletioninprogress) && $mods->get_cm($cmid)->deletioninprogress) {
continue; // M3.2 onwards - if cm is in the recycle bin, being deleted, then skip it.
Expand Down
4 changes: 4 additions & 0 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public function definition() {
$mform->setDefault('autopopulate', 0);
$mform->addHelpButton('autopopulate', 'autopopulate', 'checklist');

$mform->addElement('select', 'supportlabel', get_string('supportlabel', 'checklist'), $ynoptions);
$mform->setDefault('supportlabel', 0);
$mform->addHelpButton('supportlabel', 'supportlabel', 'checklist');

$checkdisable = true;
$str = 'autoupdate';
if (get_config('mod_checklist', 'linkcourses')) {
Expand Down
1 change: 1 addition & 0 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function create_instance($record = null, ?array $options = null) {
'teachercomments' => 1,
'maxgrade' => 100,
'autopopulate' => CHECKLIST_AUTOPOPULATE_NO,
'supportlabel' => 0,
'autoupdate' => CHECKLIST_AUTOUPDATE_YES,
'completionpercent' => 0,
'emailoncomplete' => 0,
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2025101800; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2026010100; // The current module version (Date: YYYYMMDDXX).
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '4.1.0.7';
$plugin->release = '4.1.0.8';
$plugin->requires = 2022112800; // Moodle 4.1.0.
$plugin->component = 'mod_checklist';
$plugin->supported = [401, 501];