Skip to content

Commit 035c693

Browse files
author
tai.letan
committed
Questionnaire: option to auto-delete responses after X time (Fixed code review)
1 parent e80d52b commit 035c693

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lang/en/questionnaire.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
$string['attemptsallowed'] = 'Attempts allowed: {$a}';
5454
$string['attemptstillinprogress'] = 'In progress. Saved on:';
5555
$string['autodeletereponse'] = 'Auto delete responses after [?]';
56-
$string['autodeletereponse_desc'] = 'Enable this setting to automatically delete old responses based on the time set in “Manage old responses after.” Disable to retain all responses.';
56+
$string['autodeletereponse_desc'] = 'Enable this setting to automatically delete old responses based on the time set in “Delete old responses after.” Disable to retain all responses.';
5757
$string['autonumbering'] = 'Auto numbering';
5858
$string['autonumbering_help'] = 'Automatic numbering of questions and pages. You might want to disable automatic numbering
5959
for questionnaires with conditional branching.';
@@ -584,8 +584,8 @@
584584
$string['resumesurvey'] = 'Resume questionnaire';
585585
$string['return'] = 'Return';
586586
$string['removeoldresponsesdefault'] = 'Never remove';
587-
$string['removeoldresponses'] = 'Manage old responses';
588-
$string['removeoldresponsesafter'] = 'Manage old responses after';
587+
$string['removeoldresponses'] = 'Delete old responses';
588+
$string['removeoldresponsesafter'] = 'Delete old responses after';
589589
$string['removeoldresponses_help'] = 'The system can automatically remove responses after a certain length of time.';
590590
$string['rightlabel'] = 'Right label';
591591
$string['rightpart'] = ' and {$a->max} is {$a->rightlabel}';

mod_form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function definition() {
145145
// Remove old responses.
146146
$isautodelete = (bool) get_config('questionnaire', 'autodeleteresponse');
147147
if ($isautodelete) {
148-
$options = questionnaire_create_remove_options();
148+
$options = $this->create_remove_options();
149149
$mform->addElement('header', 'responsehdr', get_string('removeoldresponses', 'questionnaire'));
150150
$mform->addElement('select', 'removeafter',
151151
get_string('removeoldresponsesafter', 'questionnaire'), $options);

settings.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@
5454
$settings->add(new admin_setting_configcheckbox('questionnaire/allowemailreporting',
5555
get_string('configemailreporting', 'questionnaire'), get_string('configemailreportinglong', 'questionnaire'), 0));
5656

57-
// Manage old responses after. The default value is 24 months.
58-
$options = questionnaire_create_remove_options();
59-
$settings->add(new admin_setting_configselect('questionnaire/removeoldresponses',
60-
get_string('removeoldresponsesafter', 'questionnaire'),
61-
get_string('configremoveoldresponses', 'questionnaire'), 0, $options));
62-
57+
// Delete old responses after. The default value is 24 months.
6358
$options = [
64-
'0' => new lang_string('disabled', 'questionnaire'),
65-
'1' => new lang_string('enabled', 'questionnaire'),
59+
'0' => new lang_string('disabled', 'questionnaire'),
60+
'1' => new lang_string('enabled', 'questionnaire'),
6661
];
6762
$name = get_string('autodeletereponse', 'questionnaire');
6863
$desc = get_string('autodeletereponse_desc', 'questionnaire');
6964
$setting = new admin_setting_configselect('questionnaire/autodeleteresponse', $name, $desc, 0, $options);
7065
$settings->add($setting);
66+
67+
$options = questionnaire_create_remove_options();
68+
$settings->add(new admin_setting_configselect('questionnaire/removeoldresponses',
69+
get_string('removeoldresponsesafter', 'questionnaire'),
70+
get_string('configremoveoldresponses', 'questionnaire'), 0, $options));
7171
}

0 commit comments

Comments
 (0)