Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin default privacy settings issue 417 #418

Open
wants to merge 1 commit into
base: MOODLE_400_STABLE
Choose a base branch
from
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
11 changes: 9 additions & 2 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ protected function definition() {

$mform->addElement('hidden', 'cannotchangerespondenttype');
$mform->setType('cannotchangerespondenttype', PARAM_INT);
$mform->addElement('select', 'respondenttype', get_string('respondenttype', 'questionnaire'), $questionnairerespondents);
$selectrespondenttype = $mform->addElement('select', 'respondenttype', get_string('respondenttype', 'questionnaire'),
$questionnairerespondents, array('tabindex' => 0));
$selectrespondenttype->setSelected(get_config('questionnaire', 'respondenttype'));
$mform->addHelpButton('respondenttype', 'respondenttype', 'questionnaire');
$mform->disabledIf('respondenttype', 'cannotchangerespondenttype', 'eq', 1);

$mform->addElement('select', 'resp_view', get_string('responseview', 'questionnaire'), $questionnaireresponseviewers);
$selectrespview = $mform->addElement('select', 'resp_view', get_string('responseview', 'questionnaire'),
$questionnaireresponseviewers, array('tabindex' => 0));
$selectrespview->setSelected(get_config('questionnaire', 'resp_view'));
$mform->addHelpButton('resp_view', 'responseview', 'questionnaire');

$notificationoptions = array(0 => get_string('no'), 1 => get_string('notificationsimple', 'questionnaire'),
Expand Down Expand Up @@ -144,6 +148,9 @@ protected function definition() {

$this->standard_coursemodule_elements();

// Apply locked admin settings.
$this->apply_admin_defaults();

// Buttons.
$this->add_action_buttons();
}
Expand Down
22 changes: 22 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,26 @@

$settings->add(new admin_setting_configcheckbox('questionnaire/allowemailreporting',
get_string('configemailreporting', 'questionnaire'), get_string('configemailreportinglong', 'questionnaire'), 0));

$questionnairerespondents = array (
'fullname' => get_string('respondenttypefullname', 'questionnaire'),
'anonymous' => get_string('respondenttypeanonymous', 'questionnaire'));

$respondenttypesetting = new admin_setting_configselect('questionnaire/respondenttype',
get_string('default').': '.get_string('respondenttype', 'questionnaire'),
get_string('respondenttype_help', 'questionnaire'), 'anonymous', $questionnairerespondents);
$respondenttypesetting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($respondenttypesetting);

$questionnaireresponseviewers = array (
1 => get_string('responseviewstudentswhenanswered', 'questionnaire'),
2 => get_string('responseviewstudentswhenclosed', 'questionnaire'),
3 => get_string('responseviewstudentsalways', 'questionnaire'),
0 => get_string('responseviewstudentsnever', 'questionnaire'));

$respviewsetting = new admin_setting_configselect('questionnaire/resp_view',
get_string('default').': '.get_string('responseview', 'questionnaire'),
get_string('responseview_help', 'questionnaire'), 0, $questionnaireresponseviewers);
$respviewsetting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($respviewsetting);
}