oral_expression.class.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. if(!class_exists('OralExpression')):
  15. /**
  16. * @package chamilo.exercise
  17. */
  18. class OralExpression extends Question {
  19. static $typePicture = 'audio_question.png';
  20. static $explanationLangVar = 'OralExpression';
  21. /**
  22. * Constructor
  23. */
  24. function OralExpression(){
  25. parent::question();
  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. global $text, $class;
  36. // setting the save button here and not in the question class.php
  37. $form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
  38. if (!empty($this->id)) {
  39. $form -> setDefaults(array('weighting' => Text::float_format($this->weighting, 1)));
  40. } else {
  41. if ($this -> isContent == 1) {
  42. $form -> setDefaults(array('weighting' => '10'));
  43. }
  44. }
  45. }
  46. /**
  47. * abstract function which creates the form to create / edit the answers of the question
  48. * @param the formvalidator instance
  49. */
  50. function processAnswersCreation($form) {
  51. $this->weighting = $form -> getSubmitValue('weighting');
  52. $this->save();
  53. }
  54. function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) {
  55. $header = parent::return_header($feedback_type, $counter, $score, $show_media);
  56. $header .= '<table class="'.$this->question_table_class.'">
  57. <tr>
  58. <th>&nbsp;</th>
  59. </tr>
  60. <tr>
  61. <th>'.get_lang("Answer").'</th>
  62. </tr>
  63. <tr>
  64. <th>&nbsp;</th>
  65. </tr>';
  66. return $header;
  67. }
  68. }
  69. endif;