Moodle Voting code changes


(Author : Tarun)

1. ASU customization involves changing the default behavior of the questionnaire page. Mainly, two feature changed are:

a. Remove the “Not yet answered” option from the possible choices

b. Change the default selected answer to “abstain”.

2. Code changes for both the parts have to be made in the “questiontypes.class.php” class of the questionnaire module at location {path to moodle}/mod/questionnaire/questiontypes.

2.1 Changes for part a.

if ($nbchoices > 1 && $this->precise != 2 && !$blankquestionnaire) {

echo ‘<td></td>’;  ←Comment this line (line # 1437)

}

echo ‘<td title=”‘.$title.'” class=”‘.$completeclass.'” style=”width:1%;”><input name=”‘.

$str.'” type=”radio” value=”-999″ ‘.$checked.$order.’ /></td>’; ←Comment this line (line # 1494)

2.2 Changes for part b.

echo ‘<td style=”text-align:center” class=”‘.$bg.'”>’; (line # 1505)

if ($j == 1) { ← begin new code

echo ‘<input name=”‘.$str.'” type=”radio” value=”‘.$j.'”‘.’ checked=”checked”‘.’ /></td>’;

}

else { ← end new code

$i = $j + 1;

Note: Line # might be different for different releases. Release information while documentation

###############

$plugin->version  = 2015051103;  

$plugin->requires = 2015051100;

$plugin->component = ‘mod_questionnaire’;

$plugin->release  = ‘2.9.1 (Build – 2015102801)’;

#################

Sidebar