function qformat_blackboard_6::process_responses in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format/blackboard_6/format.php \qformat_blackboard_6::process_responses()
1 call to qformat_blackboard_6::process_responses()
- qformat_blackboard_6::create_raw_question in includes/
moodle/ question/ format/ blackboard_6/ format.php
File
- includes/
moodle/ question/ format/ blackboard_6/ format.php, line 487
Class
Code
function process_responses($bb_responses, &$responses) {
foreach ($bb_responses as $bb_response) {
//Added this line to instantiate $response.
// Without instantiating the $response variable, the same object
// gets added to the array
$response = null;
if (isset($bb_response['@']['title'])) {
$response->title = $bb_response['@']['title'];
}
else {
$reponse->title = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
}
$reponse->ident = array();
if (isset($bb_response['#']['conditionvar'][0]['#'])) {
//['varequal'][0]['#'])) {
$response->ident[0] = $bb_response['#']['conditionvar'][0]['#'];
//['varequal'][0]['#'];
}
else {
if (isset($bb_response['#']['conditionvar'][0]['#']['other'][0]['#'])) {
$response->ident[0] = $bb_response['#']['conditionvar'][0]['#']['other'][0]['#'];
}
}
if (isset($bb_response['#']['conditionvar'][0]['#']['and'])) {
//[0]['#'])) {
$responseset = $bb_response['#']['conditionvar'][0]['#']['and'];
//[0]['#']['varequal'];
foreach ($responseset as $rs) {
$response->ident[] = $rs['#'];
if (!isset($response->feedback) and isset($rs['@'])) {
$response->feedback = $rs['@']['respident'];
}
}
}
else {
$response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
}
// determine what point value to give response
if (isset($bb_response['#']['setvar'])) {
switch ($bb_response['#']['setvar'][0]['#']) {
case "SCORE.max":
$response->fraction = 1;
break;
default:
// I have only seen this being 0 or unset
// there are probably fractional values of SCORE.max, but I'm not sure what they look like
$response->fraction = 0;
break;
}
}
else {
// just going to assume this is the case this is probably not correct.
$response->fraction = 0;
}
$responses[] = $response;
}
}