|
@@ 588-602 (lines=15) @@
|
| 585 |
|
public function processAnswers($questionList, $questionType, $questionInstance, $currentQuestion) |
| 586 |
|
{ |
| 587 |
|
switch ($questionType) { |
| 588 |
|
case 'multichoice': |
| 589 |
|
$objAnswer = new Answer($questionInstance->id); |
| 590 |
|
$questionWeighting = 0; |
| 591 |
|
foreach ($questionList as $slot => $answer) { |
| 592 |
|
$this->processUniqueAnswer($objAnswer, $answer, $slot + 1, $questionWeighting); |
| 593 |
|
} |
| 594 |
|
|
| 595 |
|
// saves the answers into the data base |
| 596 |
|
$objAnswer->save(); |
| 597 |
|
// sets the total weighting of the question |
| 598 |
|
$questionInstance->updateWeighting($questionWeighting); |
| 599 |
|
$questionInstance->save(); |
| 600 |
|
|
| 601 |
|
return true; |
| 602 |
|
break; |
| 603 |
|
case 'multianswer': |
| 604 |
|
$objAnswer = new Answer($questionInstance->id); |
| 605 |
|
|
|
@@ 688-701 (lines=14) @@
|
| 685 |
|
$questionInstance->save(); |
| 686 |
|
return true; |
| 687 |
|
break; |
| 688 |
|
case 'truefalse': |
| 689 |
|
$objAnswer = new Answer($questionInstance->id); |
| 690 |
|
$questionWeighting = 0; |
| 691 |
|
foreach ($questionList as $slot => $answer) { |
| 692 |
|
$this->processTrueFalse($objAnswer, $answer, $slot + 1, $questionWeighting); |
| 693 |
|
} |
| 694 |
|
|
| 695 |
|
// saves the answers into the data base |
| 696 |
|
$objAnswer->save(); |
| 697 |
|
// sets the total weighting of the question |
| 698 |
|
$questionInstance->updateWeighting($questionWeighting); |
| 699 |
|
$questionInstance->save(); |
| 700 |
|
return false; |
| 701 |
|
break; |
| 702 |
|
default: |
| 703 |
|
return false; |
| 704 |
|
break; |