dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Source for file freeanswer.class.php

Documentation is available at freeanswer.class.php

  1. <?php
  2. /*
  3.     DOKEOS - elearning and course management software
  4.  
  5.     For a full list of contributors, see documentation/credits.html
  6.  
  7.     This program is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU General Public License
  9.     as published by the Free Software Foundation; either version 2
  10.     of the License, or (at your option) any later version.
  11.     See "documentation/licence.html" more details.
  12.  
  13.     Contact:
  14.         Dokeos
  15.         Rue des Palais 44 Paleizenstraat
  16.         B-1030 Brussels - Belgium
  17.         Tel. +32 (2) 211 34 56
  18. */
  19.  
  20.  
  21. /**
  22. *    File containing the FreeAnswer class.
  23. *    This class allows to instantiate an object of type FREE_ANSWER,
  24. *    extending the class question
  25. *    @package dokeos.exercise
  26. *     @author Eric Marguin
  27. *     @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  28. */
  29.  
  30.  
  31. if(!class_exists('FreeAnswer')):
  32.  
  33. class FreeAnswer extends Question {
  34.  
  35.     static $typePicture 'open_answer.gif';
  36.     static $explanationLangVar 'freeAnswer';
  37.  
  38.     /**
  39.      * Constructor
  40.      */
  41.     function FreeAnswer(){
  42.         parent::question();
  43.         $this -> type = FREE_ANSWER;
  44.     }
  45.  
  46.     /**
  47.      * function which redifines Question::createAnswersForm
  48.      * @param the formvalidator instance
  49.      */
  50.     function createAnswersForm ($form{
  51.  
  52.         $form -> addElement('text','weighting',get_lang('Weighting'),'size="5"');
  53.         if(!empty($this->id))
  54.         {
  55.             $form -> setDefaults(array('weighting' => $this->weighting));
  56.         }
  57.         else {
  58.             $form -> setDefaults(array('weighting' => '10'));
  59.         }
  60.  
  61.     }
  62.  
  63.  
  64.     /**
  65.      * abstract function which creates the form to create / edit the answers of the question
  66.      * @param the formvalidator instance
  67.      */
  68.     function processAnswersCreation($form
  69.     {
  70.         $this -> weighting = $form -> getSubmitValue('weighting');
  71.         $this->save();
  72.     }
  73. }
  74. endif;
  75. ?>

Documentation generated on Thu, 12 Jun 2008 13:32:11 -0500 by phpDocumentor 1.4.1