oral_expression.class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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'),'size="5"');
  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' => 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, $counter = null) {
  55. parent::return_header($feedback_type, $counter);
  56. $header = '<table width="100%" border="0" cellspacing="3" cellpadding="3">
  57. <tr>
  58. <td>&nbsp;</td>
  59. </tr>
  60. <tr>
  61. <td><i>'.get_lang("Answer").'</i> </td>
  62. </tr>
  63. <tr>
  64. <td>&nbsp;</td>
  65. </tr>';
  66. return $header;
  67. }
  68. }
  69. endif;