oral_expression.class.php 2.1 KB

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