Skip to content

Commit

Permalink
MDL-38573 choice: Reformat settings form
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Apr 17, 2013
1 parent 9b81eef commit ad4bbda
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
6 changes: 5 additions & 1 deletion mod/choice/lang/en/choice.php
Expand Up @@ -28,7 +28,7 @@
$string['answered'] = 'Answered';
$string['completionsubmit'] = 'Show as complete when user makes a choice';
$string['displayhorizontal'] = 'Display horizontally';
$string['displaymode'] = 'Display mode';
$string['displaymode'] = 'Display mode for the options';
$string['displayvertical'] = 'Display vertically';
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
$string['atleastoneoption'] = 'You need to provide at least one possible answer.';
Expand All @@ -55,6 +55,7 @@
$string['choicetext'] = 'Choice text';
$string['chooseaction'] = 'Choose an action ...';
$string['limit'] = 'Limit';
$string['limitno'] = 'Limit {no}';
$string['limitanswers'] = 'Limit the number of responses allowed';
$string['modulename'] = 'Choice';
$string['modulename_help'] = 'The choice activity module enables a teacher to ask a single question and offer a selection of possible responses.
Expand All @@ -78,6 +79,8 @@
$string['numberofuser'] = 'The number of user';
$string['numberofuserinpercentage'] = 'The number of user in percentage';
$string['option'] = 'Option';
$string['optionno'] = 'Option {no}';
$string['options'] = 'Options';
$string['page-mod-choice-x'] = 'Any choice module page';
$string['pluginadministration'] = 'Choice administration';
$string['pluginname'] = 'Choice';
Expand All @@ -94,6 +97,7 @@
$string['responses'] = 'Responses';
$string['responsesresultgraphheader'] = 'Graph display';
$string['responsesto'] = 'Responses to {$a}';
$string['results'] = 'Results';
$string['savemychoice'] = 'Save my choice';
$string['showunanswered'] = 'Show column for unanswered';
$string['spaceleft'] = 'space available';
Expand Down
33 changes: 15 additions & 18 deletions mod/choice/mod_form.php
Expand Up @@ -25,20 +25,21 @@ function definition() {

$this->add_intro_editor(true, get_string('chatintro', 'chat'));

//-------------------------------------------------------------------------------
$repeatarray = array();
$repeatarray[] = $mform->createElement('header', '', get_string('option','choice').' {no}');
$repeatarray[] = $mform->createElement('text', 'option', get_string('option','choice'));
$repeatarray[] = $mform->createElement('text', 'limit', get_string('limit','choice'));
$repeatarray[] = $mform->createElement('hidden', 'optionid', 0);
$mform->addElement('select', 'display', get_string("displaymode","choice"), $CHOICE_DISPLAY);

//-------------------------------------------------------------------------------
$mform->addElement('header', 'optionhdr', get_string('options', 'choice'));

$mform->addElement('selectyesno', 'allowupdate', get_string("allowupdate", "choice"));

$menuoptions = array();
$menuoptions[0] = get_string('disable');
$menuoptions[1] = get_string('enable');
$mform->addElement('header', 'limithdr', get_string('limit', 'choice'));
$mform->addElement('select', 'limitanswers', get_string('limitanswers', 'choice'), $menuoptions);
$mform->addElement('selectyesno', 'limitanswers', get_string('limitanswers', 'choice'));
$mform->addHelpButton('limitanswers', 'limitanswers', 'choice');

$repeatarray = array();
$repeatarray[] = $mform->createElement('text', 'option', get_string('optionno', 'choice'));
$repeatarray[] = $mform->createElement('text', 'limit', get_string('limitno', 'choice'));
$repeatarray[] = $mform->createElement('hidden', 'optionid', 0);

if ($this->_instance){
$repeatno = $DB->count_records('choice_options', array('choiceid'=>$this->_instance));
$repeatno += 2;
Expand All @@ -58,15 +59,15 @@ function definition() {
$mform->setType('optionid', PARAM_INT);

$this->repeat_elements($repeatarray, $repeatno,
$repeateloptions, 'option_repeats', 'option_add_fields', 3);
$repeateloptions, 'option_repeats', 'option_add_fields', 3, null, true);

// Make the first option required
if ($mform->elementExists('option[0]')) {
$mform->addRule('option[0]', get_string('atleastoneoption', 'choice'), 'required', null, 'client');
}

//-------------------------------------------------------------------------------
$mform->addElement('header', 'timerestricthdr', get_string('timerestrict', 'choice'));
$mform->addElement('header', 'timerestricthdr', get_string('availability'));
$mform->addElement('checkbox', 'timerestrict', get_string('timerestrict', 'choice'));

$mform->addElement('date_time_selector', 'timeopen', get_string("choiceopen", "choice"));
Expand All @@ -76,17 +77,13 @@ function definition() {
$mform->disabledIf('timeclose', 'timerestrict');

//-------------------------------------------------------------------------------
$mform->addElement('header', 'miscellaneoussettingshdr', get_string('miscellaneoussettings', 'form'));

$mform->addElement('select', 'display', get_string("displaymode","choice"), $CHOICE_DISPLAY);
$mform->addElement('header', 'resultshdr', get_string('results', 'choice'));

$mform->addElement('select', 'showresults', get_string("publish", "choice"), $CHOICE_SHOWRESULTS);

$mform->addElement('select', 'publish', get_string("privacy", "choice"), $CHOICE_PUBLISH);
$mform->disabledIf('publish', 'showresults', 'eq', 0);

$mform->addElement('selectyesno', 'allowupdate', get_string("allowupdate", "choice"));

$mform->addElement('selectyesno', 'showunanswered', get_string("showunanswered", "choice"));


Expand Down

0 comments on commit ad4bbda

Please sign in to comment.