Minor - format code

skala
Julio Montoya 13 years ago
parent b526b0889d
commit bf006a17be
  1. 37
      main/exercice/freeanswer.class.php

@ -1,13 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* File containing the FreeAnswer class.
* This class allows to instantiate an object of type FREE_ANSWER,
* extending the class question
* @package chamilo.exercise
* @author Eric Marguin
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
* File containing the FreeAnswer class.
* This class allows to instantiate an object of type FREE_ANSWER,
* extending the class question
* @package chamilo.exercise
* @author Eric Marguin
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
@ -16,7 +15,8 @@
/**
* @package chamilo.exercise
*/
class FreeAnswer extends Question {
class FreeAnswer extends Question
{
static $typePicture = 'open_answer.gif';
static $explanationLangVar = 'FreeAnswer';
@ -24,9 +24,10 @@ class FreeAnswer extends Question {
/**
* Constructor
*/
function FreeAnswer() {
function FreeAnswer()
{
parent::question();
$this->type = FREE_ANSWER;
$this->type = FREE_ANSWER;
$this->isContent = $this->getIsContent();
}
@ -34,10 +35,11 @@ class FreeAnswer extends Question {
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
function createAnswersForm($form) {
function createAnswersForm($form)
{
$form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
// setting the save button here and not in the question class.php
$form->addElement('style_submit_button', 'submitQuestion', $this->submitText, 'class="' . $this->submitClass . '"');
$form->addElement('style_submit_button', 'submitQuestion', $this->submitText, 'class="'.$this->submitClass.'"');
if (!empty($this->id)) {
$form->setDefaults(array('weighting' => Text::float_format($this->weighting, 1)));
} else {
@ -51,22 +53,25 @@ class FreeAnswer extends Question {
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
*/
function processAnswersCreation($form) {
function processAnswersCreation($form)
{
$this->weighting = $form->getSubmitValue('weighting');
$this->save();
}
function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) {
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 . '" >
$header .= '<table class="'.$this->question_table_class.'" >
<tr>
<th>' . get_lang("Answer") . '</th>
<th>'.get_lang("Answer").'</th>
</tr>';
return $header;
}
}

Loading…
Cancel
Save