Moodle – Default Neutral Vote Option
The default moodle neutral vote option is to check a ‘radio button’ “neutral” by default for a given vote. This is not defined in moodle itself, and required a small modification to one of the files.
This document addresses the change required to be made,
The file to be modified is under
/var/www/moodle/mod/questionnaire/questiontypes/
The file is,
questiontypes.class.php
Depending on the version of moodle, it may be necessary to make modifications to the file in the new location, instead of replacing the file – as new features could have been added. Doing a diff of the backup file and the modified file will give you the changes,
Diff output in euclid (old version of moodle)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ diff questiontypes.class.php questiontypes.class.php.bk
1228,1232d1227
< //ASU SoMSS new code for voting: this checks a default column of the radio buttons, which is column 2, ankit
< if ($j == 1)
< echo ‘<input name=”‘.$str.'” type=”radio” value=”‘.$j.'”‘.’ checked=”checked”‘.’ /></td>’;
< else
< //end new code
1246c1241
< $checked = ‘ ‘;
—
> $checked = ”;
1945c1940
< $table->data[] = array(format_text($content, FORMAT_HTML), $out, sprintf(‘%.3f’, $avg));
—
> $table->data[] = array(format_text($content, FORMAT_HTML), $out, sprintf(‘%.1f’, $avg));
1949c1944
< $avg = sprintf(‘%.3f’, $avg);
—
> $avg = sprintf(‘%.1f’, $avg);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Diff output in mathcms (moodle2 – new version of moodle)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ diff questiontypes.class.php questiontypes.class.php.20120525
1271,1278c1271,1272
< //ASU SoMSS new code for voting: this checks a default column of the radio buttons, which is column 2, ankit
< if ($j == 1) {
< echo ‘<input name=”‘.$str.'” type=”radio” value=”‘.$j.'”‘.’ checked=”checked”‘.’ /></td>’;
< }
< else {
< //end new code
< $i = $j+1;
< echo html_writer::tag(‘span’, get_string(‘option’, ‘questionnaire’, $i),
—
> $i = $j+1;
> echo html_writer::tag(‘span’, get_string(‘option’, ‘questionnaire’, $i),
1280,1282c1274,1275
< echo ‘<input name=”‘.$str.'” type=”radio” value=”‘.$j .'”‘.$checked.$order.’ /></td>’;
< }
< if ($bg == ‘qntype c0’) {
—
> echo ‘<input name=”‘.$str.'” type=”radio” value=”‘.$j .'”‘.$checked.$order.’ /></td>’;
> if ($bg == ‘qntype c0’) {
1294c1287
< $checked = ‘ ‘;
—
> $checked = ”;
2012c2005
< $table->data[] = array(format_text($content, FORMAT_HTML), $out, sprintf(‘%.3f’, $avg));
—
> $table->data[] = array(format_text($content, FORMAT_HTML), $out, sprintf(‘%.1f’, $avg));
2019c2012
< $avg = sprintf(‘%.3f’, $avg);
—
> $avg = sprintf(‘%.1f’, $avg);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
