MDL-43770 mod_choice: Add option to include inactive users' responses

This commit is contained in:
Tony Butler
2015-03-20 09:55:16 +00:00
parent 6de3eee04c
commit 799770cbd7
6 changed files with 21 additions and 2 deletions
@@ -41,7 +41,7 @@ class backup_choice_activity_structure_step extends backup_activity_structure_st
'name', 'intro', 'introformat', 'publish',
'showresults', 'display', 'allowupdate', 'showunanswered',
'limitanswers', 'timeopen', 'timeclose', 'timemodified',
'completionsubmit', 'showpreview'));
'completionsubmit', 'showpreview', 'includeinactive'));
$options = new backup_nested_element('options');
+1
View File
@@ -18,6 +18,7 @@
<FIELD NAME="allowupdate" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="allowmultiple" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="showunanswered" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="includeinactive" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="limitanswers" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
+15
View File
@@ -80,6 +80,21 @@ function xmldb_choice_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014111001, 'choice');
}
if ($oldversion < 2014111002) {
// Define field includeinactive to be added to choice.
$table = new xmldb_table('choice');
$field = new xmldb_field('includeinactive', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1', 'showunanswered');
// Conditionally launch add field includeactive.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Choice savepoint reached.
upgrade_mod_savepoint(true, 2014111002, 'choice');
}
return true;
}
+1
View File
@@ -62,6 +62,7 @@ $string['choicesaved'] = 'Your choice has been saved';
$string['choicetext'] = 'Choice text';
$string['chooseaction'] = 'Choose an action ...';
$string['description'] = 'Description';
$string['includeinactive'] = 'Include responses from inactive/suspended users';
$string['limit'] = 'Limit';
$string['limitno'] = 'Limit {no}';
$string['limitanswers'] = 'Limit the number of responses allowed';
+2
View File
@@ -93,6 +93,8 @@ class mod_choice_mod_form extends moodleform_mod {
$mform->addElement('selectyesno', 'showunanswered', get_string("showunanswered", "choice"));
$mform->addElement('selectyesno', 'includeinactive', get_string('includeinactive', 'choice'));
$mform->setDefault('includeinactive', 0);
//-------------------------------------------------------------------------------
$this->standard_coursemodule_elements();
+1 -1
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111001; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2014111002; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2014110400; // Requires this Moodle version
$plugin->component = 'mod_choice'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 0;