| @@ 557-582 (lines=26) @@ | ||
| 554 | * @param integer $position |
|
| 555 | * @return integer db response |
|
| 556 | */ |
|
| 557 | public function processUniqueAnswer($objAnswer, $answerValues, $position) |
|
| 558 | { |
|
| 559 | $questionWeighting = $nbrGoodAnswers = 0; |
|
| 560 | $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0; |
|
| 561 | $answer = $answerValues['answertext']; |
|
| 562 | $comment = $answerValues['feedback']; |
|
| 563 | $weighting = $answerValues['fraction']; |
|
| 564 | $weighting = abs($weighting); |
|
| 565 | if ($weighting > 0) { |
|
| 566 | $questionWeighting += $weighting; |
|
| 567 | } |
|
| 568 | $goodAnswer = $correct ? true : false; |
|
| 569 | ||
| 570 | $objAnswer->createAnswer( |
|
| 571 | $answer, |
|
| 572 | $goodAnswer, |
|
| 573 | $comment, |
|
| 574 | $weighting, |
|
| 575 | $position, |
|
| 576 | null, |
|
| 577 | null, |
|
| 578 | '' |
|
| 579 | ); |
|
| 580 | ||
| 581 | return $questionWeighting; |
|
| 582 | } |
|
| 583 | ||
| 584 | /** |
|
| 585 | * Process Chamilo FillBlanks |
|
| @@ 592-617 (lines=26) @@ | ||
| 589 | * @param integer $position |
|
| 590 | * @return integer db response |
|
| 591 | */ |
|
| 592 | public function processFillBlanks($objAnswer, $answerValues, $position) |
|
| 593 | { |
|
| 594 | $questionWeighting = $nbrGoodAnswers = 0; |
|
| 595 | $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0; |
|
| 596 | $answer = $answerValues['answertext']; |
|
| 597 | $comment = $answerValues['feedback']; |
|
| 598 | $weighting = $answerValues['fraction']; |
|
| 599 | $weighting = abs($weighting); |
|
| 600 | if ($weighting > 0) { |
|
| 601 | $questionWeighting += $weighting; |
|
| 602 | } |
|
| 603 | $goodAnswer = $correct ? true : false; |
|
| 604 | ||
| 605 | $objAnswer->createAnswer( |
|
| 606 | $answer, |
|
| 607 | $goodAnswer, |
|
| 608 | $comment, |
|
| 609 | $weighting, |
|
| 610 | $position, |
|
| 611 | null, |
|
| 612 | null, |
|
| 613 | '' |
|
| 614 | ); |
|
| 615 | ||
| 616 | return $questionWeighting; |
|
| 617 | } |
|
| 618 | ||
| 619 | ||
| 620 | /** |
|