123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- if (!class_exists('FreeAnswer')):
-
- class FreeAnswer extends Question {
- static $typePicture = 'open_answer.gif';
- static $explanationLangVar = 'FreeAnswer';
-
- function FreeAnswer() {
- parent::question();
- $this->type = FREE_ANSWER;
- $this->isContent = $this->getIsContent();
- }
-
- function createAnswersForm($form) {
- $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
- global $text, $class;
-
- $form->addElement('style_submit_button', 'submitQuestion', $text, 'class="' . $class . '"');
- if (!empty($this->id)) {
- $form->setDefaults(array('weighting' => Text::float_format($this->weighting, 1)));
- } else {
- if ($this->isContent == 1) {
- $form->setDefaults(array('weighting' => '10'));
- }
- }
- }
-
- function processAnswersCreation($form) {
- $this->weighting = $form->getSubmitValue('weighting');
- $this->save();
- }
- function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) {
- if (!empty($score['comments']) || $score['score'] > 0) {
- $score['revised'] = true;
- } else {
- $score['revised'] = false;
- }
- $header = parent::return_header($feedback_type, $counter, $score, $show_media);
- $header .= '<table class="' . $this->question_table_class . '" >
- <tr>
- <th>' . get_lang("Answer") . '</th>
- </tr>';
- return $header;
- }
- }
- endif;
|