Minor - Format code, add docs

1.10.x
Julio Montoya 10 years ago
parent c2eb613a0e
commit 2393040ab8
  1. 3
      main/exercice/Draggable.php
  2. 4
      main/exercice/MatchingDraggable.php
  3. 6
      main/exercice/calculated_answer.class.php
  4. 2
      main/exercice/fill_blanks.class.php
  5. 6
      main/exercice/freeanswer.class.php
  6. 6
      main/exercice/global_multiple_answer.class.php
  7. 4
      main/exercice/multiple_answer_combination.class.php
  8. 1
      main/exercice/multiple_answer_combination_true_false.class.php
  9. 5
      main/exercice/multiple_answer_true_false.class.php
  10. 1
      main/exercice/oral_expression.class.php
  11. 4
      main/exercice/unique_answer.class.php

@ -1,5 +1,4 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -134,7 +133,6 @@ class Draggable extends Question
} }
$form->addHtml('</tbody></table>'); $form->addHtml('</tbody></table>');
$group = array();
$renderer->setElementTemplate( $renderer->setElementTemplate(
'<div class="form-group"><div class="col-sm-offset-2">{element}', '<div class="form-group"><div class="col-sm-offset-2">{element}',
@ -220,5 +218,4 @@ class Draggable extends Question
return $header; return $header;
} }
} }

@ -1,5 +1,4 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -205,7 +204,7 @@ class MatchingDraggable extends Question
/** /**
* Process the creation of answers * Process the creation of answers
* @param type $form * @param FormValidator $form
*/ */
public function processAnswersCreation($form) public function processAnswersCreation($form)
{ {
@ -258,5 +257,4 @@ class MatchingDraggable extends Question
return $header; return $header;
} }
} }

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Class CalculatedAnswer * Class CalculatedAnswer
* This class contains calculated answer form and answer processing functions * This class contains calculated answer form and answer processing functions
@ -24,7 +25,7 @@ class CalculatedAnswer extends Question
/** /**
* function which redefines Question::createAnswersForm * function which redefines Question::createAnswersForm
* @param the formvalidator instance * @param FormValidator $form
*/ */
function createAnswersForm($form) function createAnswersForm($form)
{ {
@ -161,7 +162,7 @@ class CalculatedAnswer extends Question
$form->addRule('answerVariations', get_lang('GiveAnswerVariations'),'required'); $form->addRule('answerVariations', get_lang('GiveAnswerVariations'),'required');
$form->setDefaults(array('answerVariations' => '1')); $form->setDefaults(array('answerVariations' => '1'));
global $text, $class; global $text;
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$form->addButtonSave($text, 'submitQuestion'); $form->addButtonSave($text, 'submitQuestion');
@ -273,6 +274,7 @@ class CalculatedAnswer extends Question
) )
) )
); );
return empty($result) ? false : true; return empty($result) ? false : true;
} }
} }

@ -288,8 +288,6 @@ class FillBlanks extends Question
*/ */
public function processAnswersCreation($form) public function processAnswersCreation($form)
{ {
global $charset;
$answer = $form->getSubmitValue('answer'); $answer = $form->getSubmitValue('answer');
// Due the ckeditor transform the elements to their HTML value // Due the ckeditor transform the elements to their HTML value

@ -25,11 +25,11 @@ class FreeAnswer extends Question
/** /**
* function which redifines Question::createAnswersForm * function which redifines Question::createAnswersForm
* @param the formvalidator instance * @param formvalidator $form
*/ */
function createAnswersForm($form) function createAnswersForm($form)
{ {
$form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1')); $form->addElement('text', 'weighting', get_lang('Weighting'));
global $text, $class; global $text, $class;
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$form->addButtonSave($text, 'submitQuestion'); $form->addButtonSave($text, 'submitQuestion');
@ -44,7 +44,7 @@ class FreeAnswer extends Question
/** /**
* abstract function which creates the form to create/edit the answers of the question * abstract function which creates the form to create/edit the answers of the question
* @param FormValidator * @param FormValidator $form
*/ */
function processAnswersCreation($form) function processAnswersCreation($form)
{ {

@ -21,7 +21,7 @@ class GlobalMultipleAnswer extends Question
/** /**
* function which redefines Question::createAnswersForm * function which redefines Question::createAnswersForm
* @param the FormValidator * @param FormValidator $form
*/ */
public function createAnswersForm($form) public function createAnswersForm($form)
{ {
@ -81,7 +81,7 @@ class GlobalMultipleAnswer extends Question
$defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['comment[' . $i . ']'] = $answer->comment[$i];
$defaults['correct[' . $i . ']'] = $answer->correct[$i]; $defaults['correct[' . $i . ']'] = $answer->correct[$i];
//------------- D<EFBFBD>but // start
$scoreA = $answer->weighting[$i]; $scoreA = $answer->weighting[$i];
} }
if ($scoreA > 0) { if ($scoreA > 0) {
@ -162,7 +162,7 @@ class GlobalMultipleAnswer extends Question
/** /**
* abstract function which creates the form to create / edit the answers of the question * abstract function which creates the form to create / edit the answers of the question
* @param the FormValidator instance * @param FormValidator $form
*/ */
function processAnswersCreation($form) function processAnswersCreation($form)
{ {

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Class MultipleAnswer * Class MultipleAnswer
* *
@ -11,7 +12,6 @@
**/ **/
class MultipleAnswerCombination extends Question class MultipleAnswerCombination extends Question
{ {
static $typePicture = 'mcmac.png'; static $typePicture = 'mcmac.png';
static $explanationLangVar = 'MultipleSelectCombination'; static $explanationLangVar = 'MultipleSelectCombination';
@ -27,7 +27,7 @@ class MultipleAnswerCombination extends Question
/** /**
* function which redifines Question::createAnswersForm * function which redifines Question::createAnswersForm
* @param $form FormValidator * @param FormValidator $form
* @param the answers number to display * @param the answers number to display
*/ */
function createAnswersForm($form) function createAnswersForm($form)

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Class MultipleAnswer * Class MultipleAnswer
* *

@ -213,7 +213,7 @@ class MultipleAnswerTrueFalse extends Question
} }
} }
global $text, $class; global $text;
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
@ -289,7 +289,8 @@ class MultipleAnswerTrueFalse extends Question
$comment = trim($form -> getSubmitValue('comment['.$i.']')); $comment = trim($form -> getSubmitValue('comment['.$i.']'));
$goodAnswer = trim($form -> getSubmitValue('correct['.$i.']')); $goodAnswer = trim($form -> getSubmitValue('correct['.$i.']'));
if (empty($options)) { if (empty($options)) {
//If this is the first time that the question is created when change the default values from the form 1 and 2 by the correct "option id" registered //If this is the first time that the question is created when
// change the default values from the form 1 and 2 by the correct "option id" registered
$goodAnswer = $sorted_by_position[$goodAnswer]['id']; $goodAnswer = $sorted_by_position[$goodAnswer]['id'];
} }
$questionWeighting += $extra_values[0]; //By default 0 has the correct answers $questionWeighting += $extra_values[0]; //By default 0 has the correct answers

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Class OralExpression * Class OralExpression
* This class allows to instantiate an object of type FREE_ANSWER, * This class allows to instantiate an object of type FREE_ANSWER,

@ -259,9 +259,7 @@ class UniqueAnswer extends Question
$form->addHtml('</tbody>'); $form->addHtml('</tbody>');
$form->addHtml('</table>'); $form->addHtml('</table>');
$navigator_info = api_get_navigator(); global $text;
global $text, $class;
$buttonGroup = []; $buttonGroup = [];
//ie6 fix //ie6 fix

Loading…
Cancel
Save