oral_expression.class.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class OralExpression
  5. * This class allows to instantiate an object of type FREE_ANSWER,
  6. * extending the class question
  7. * @author Eric Marguin
  8. * @package chamilo.exercise
  9. */
  10. class OralExpression extends Question
  11. {
  12. static $typePicture = 'audio_question.png';
  13. static $explanationLangVar = 'OralExpression';
  14. /**
  15. * Constructor
  16. */
  17. function OralExpression()
  18. {
  19. parent::question();
  20. $this -> type = ORAL_EXPRESSION;
  21. $this -> isContent = $this-> getIsContent();
  22. }
  23. /**
  24. * function which redifines Question::createAnswersForm
  25. * @param $form FormValidator
  26. */
  27. function createAnswersForm ($form)
  28. {
  29. $form -> addElement('text','weighting',get_lang('Weighting'), array('class' => 'span1'));
  30. global $text, $class;
  31. // setting the save button here and not in the question class.php
  32. $form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
  33. if (!empty($this->id)) {
  34. $form -> setDefaults(array('weighting' => float_format($this->weighting, 1)));
  35. } else {
  36. if ($this -> isContent == 1) {
  37. $form -> setDefaults(array('weighting' => '10'));
  38. }
  39. }
  40. }
  41. /**
  42. * abstract function which creates the form to create / edit the answers of the question
  43. * @param the formvalidator instance
  44. */
  45. function processAnswersCreation($form)
  46. {
  47. $this->weighting = $form -> getSubmitValue('weighting');
  48. $this->save();
  49. }
  50. function return_header($feedback_type = null, $counter = null, $score = null)
  51. {
  52. $header = parent::return_header($feedback_type, $counter, $score);
  53. $header .= '<table class="'.$this->question_table_class.'">
  54. <tr>
  55. <th>&nbsp;</th>
  56. </tr>
  57. <tr>
  58. <th>'.get_lang("Answer").'</th>
  59. </tr>
  60. <tr>
  61. <th>&nbsp;</th>
  62. </tr>';
  63. return $header;
  64. }
  65. }