From 0d7ff4b6e733360f085d73c5dce55540a9ce2127 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 12 Jul 2016 14:46:19 +0200 Subject: [PATCH] Fix classes --- main/exercise/Draggable.php | 5 +-- main/exercise/MatchingDraggable.php | 2 +- main/exercise/UniqueAnswerImage.php | 9 ++-- main/exercise/exercise_reminder.php | 41 ++++++++++++------- main/exercise/exercise_submit_modal.php | 4 +- main/exercise/fill_blanks.class.php | 4 +- main/exercise/freeanswer.class.php | 4 +- .../exercise/global_multiple_answer.class.php | 4 +- main/exercise/hotspot.class.php | 20 +++++---- main/exercise/matching.class.php | 4 +- main/exercise/multiple_answer.class.php | 4 +- .../multiple_answer_combination.class.php | 4 +- ...le_answer_combination_true_false.class.php | 6 +-- .../multiple_answer_true_false.class.php | 4 +- main/exercise/oral_expression.class.php | 6 +-- main/exercise/unique_answer.class.php | 5 +-- .../unique_answer_no_option.class.php | 5 +-- 17 files changed, 73 insertions(+), 58 deletions(-) diff --git a/main/exercise/Draggable.php b/main/exercise/Draggable.php index 6a130ae18b..d6ee5be19b 100644 --- a/main/exercise/Draggable.php +++ b/main/exercise/Draggable.php @@ -8,8 +8,8 @@ */ class Draggable extends Question { - static $typePicture = 'ordering.png'; - static $explanationLangVar = 'Draggable'; + public static $typePicture = 'ordering.png'; + public static $explanationLangVar = 'Draggable'; /** * Class constructor @@ -17,7 +17,6 @@ class Draggable extends Question public function __construct() { parent::__construct(); - $this->type = DRAGGABLE; $this->isContent = $this->getIsContent(); } diff --git a/main/exercise/MatchingDraggable.php b/main/exercise/MatchingDraggable.php index ce361c3472..4e53e395d5 100644 --- a/main/exercise/MatchingDraggable.php +++ b/main/exercise/MatchingDraggable.php @@ -9,7 +9,7 @@ class MatchingDraggable extends Question { public static $typePicture = 'matchingdrag.png'; - static $explanationLangVar = 'MatchingDraggable'; + public static $explanationLangVar = 'MatchingDraggable'; /** * Class constructor diff --git a/main/exercise/UniqueAnswerImage.php b/main/exercise/UniqueAnswerImage.php index 1e9da581a4..f6cbf256cb 100644 --- a/main/exercise/UniqueAnswerImage.php +++ b/main/exercise/UniqueAnswerImage.php @@ -9,13 +9,14 @@ */ class UniqueAnswerImage extends UniqueAnswer { + public static $typePicture = 'uaimg.png'; + public static $explanationLangVar = 'UniqueAnswerImage'; - static $typePicture = 'uaimg.png'; - static $explanationLangVar = 'UniqueAnswerImage'; - + /** + * UniqueAnswerImage constructor. + */ public function __construct() { - //this is highly important parent::__construct(); $this->type = UNIQUE_ANSWER_IMAGE; $this->isContent = $this->getIsContent(); diff --git a/main/exercise/exercise_reminder.php b/main/exercise/exercise_reminder.php index d626d60542..0f8bf3fd36 100755 --- a/main/exercise/exercise_reminder.php +++ b/main/exercise/exercise_reminder.php @@ -1,5 +1,8 @@ $options) { foreach ($options as $item) { @@ -204,11 +208,10 @@ foreach ($question_list as $questionId) { unset($objQuestionTmp); // creates a temporary Question object - $objQuestionTmp = Question :: read($questionId); - - $quesId = $objQuestionTmp->selectId(); - $check_id = 'remind_list['.$questionId.']'; - $attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); + $objQuestionTmp = Question:: read($questionId); + $quesId = $objQuestionTmp->selectId(); + $check_id = 'remind_list['.$questionId.']'; + $attributes = array('id' => $check_id, 'onclick' => "save_remind_item(this, '$questionId');"); if (in_array($questionId, $remind_list)) { $attributes['checked'] = 1; @@ -217,9 +220,8 @@ foreach ($question_list as $questionId) { $label_attributes['class'] = 'checkbox'; $label_attributes['for'] = $check_id; $label_attributes['class'] = "checkbox"; - - $checkbox = Display::input('checkbox', 'remind_list['.$questionId.']', '', $attributes); - $url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1'; + $checkbox = Display::input('checkbox', 'remind_list['.$questionId.']', '', $attributes); + $url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1'; $counter++; if ($objExercise->type == ONE_PER_PAGE) { @@ -232,14 +234,23 @@ foreach ($question_list as $questionId) { if (!in_array($questionId, $exercise_result)) { $question_title = Display::label($question_title, 'warning'); } - $question_title = Display::tag('label', $checkbox.$question_title, $label_attributes); - $table .= Display::div($question_title, array('class'=>'exercise_reminder_item')); + $question_title = Display::tag('label', $checkbox.$question_title, $label_attributes); + $table .= Display::div($question_title, array('class'=>'exercise_reminder_item')); } // end foreach() block that loops over all questions echo Display::div($table, array('class'=>'question-check-test')); -$exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-warning')); -$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn btn-success')); +$exercise_actions = Display::url( + get_lang('EndTest'), + 'javascript://', + array('onclick' => 'final_submit();', 'class' => 'btn btn-warning') +); +$exercise_actions .= ' '. + Display::url( + get_lang('ReviewQuestions'), + 'javascript://', + array('onclick'=>'review_questions();','class'=>'btn btn-success') + ); echo Display::div('', array('class'=>'clear')); echo Display::div($exercise_actions, array('class'=>'form-actions')); diff --git a/main/exercise/exercise_submit_modal.php b/main/exercise/exercise_submit_modal.php index a474176387..31ae8ee377 100755 --- a/main/exercise/exercise_submit_modal.php +++ b/main/exercise/exercise_submit_modal.php @@ -1,10 +1,12 @@ */ -use \ChamiloSession as Session; require_once '../inc/global.inc.php'; api_protect_course_script(false); diff --git a/main/exercise/fill_blanks.class.php b/main/exercise/fill_blanks.class.php index 21c3ed1bd3..d01f3393ec 100755 --- a/main/exercise/fill_blanks.class.php +++ b/main/exercise/fill_blanks.class.php @@ -10,8 +10,8 @@ **/ class FillBlanks extends Question { - static $typePicture = 'fill_in_blanks.png'; - static $explanationLangVar = 'FillBlanks'; + public static $typePicture = 'fill_in_blanks.png'; + public static $explanationLangVar = 'FillBlanks'; const FILL_THE_BLANK_STANDARD = 0; const FILL_THE_BLANK_MENU = 1; diff --git a/main/exercise/freeanswer.class.php b/main/exercise/freeanswer.class.php index 090266bda6..daf3ee2931 100755 --- a/main/exercise/freeanswer.class.php +++ b/main/exercise/freeanswer.class.php @@ -10,8 +10,8 @@ */ class FreeAnswer extends Question { - static $typePicture = 'open_answer.png'; - static $explanationLangVar = 'FreeAnswer'; + public static $typePicture = 'open_answer.png'; + public static $explanationLangVar = 'FreeAnswer'; /** * Constructor diff --git a/main/exercise/global_multiple_answer.class.php b/main/exercise/global_multiple_answer.class.php index dbcc71a8a4..8a1b9cf2ef 100755 --- a/main/exercise/global_multiple_answer.class.php +++ b/main/exercise/global_multiple_answer.class.php @@ -6,8 +6,8 @@ */ class GlobalMultipleAnswer extends Question { - static $typePicture = 'mcmagl.png'; - static $explanationLangVar = 'GlobalMultipleAnswer'; + public static $typePicture = 'mcmagl.png'; + public static $explanationLangVar = 'GlobalMultipleAnswer'; /** * diff --git a/main/exercise/hotspot.class.php b/main/exercise/hotspot.class.php index 65d183e3bd..e5eeafbd6f 100755 --- a/main/exercise/hotspot.class.php +++ b/main/exercise/hotspot.class.php @@ -12,13 +12,16 @@ **/ class HotSpot extends Question { - static $typePicture = 'hotspot.png'; - static $explanationLangVar = 'HotSpot'; + public static $typePicture = 'hotspot.png'; + public static $explanationLangVar = 'HotSpot'; + /** + * HotSpot constructor. + */ public function __construct() { parent::__construct(); - $this -> type = HOT_SPOT; + $this->type = HOT_SPOT; } public function display() @@ -91,17 +94,20 @@ class HotSpot extends Question */ class HotSpotDelineation extends HotSpot { - static $typePicture = 'hotspot-delineation.png'; - static $explanationLangVar = 'HotspotDelineation'; + public static $typePicture = 'hotspot-delineation.png'; + public static $explanationLangVar = 'HotspotDelineation'; - function __construct() + /** + * HotSpotDelineation constructor. + */ + public function __construct() { parent::__construct(); $this -> type = HOT_SPOT_DELINEATION; } - function createForm (&$form, $fck_config=0) + function createForm(&$form, $fck_config=0) { parent::createForm ($form, $fck_config); } diff --git a/main/exercise/matching.class.php b/main/exercise/matching.class.php index e6ddc12787..e39b721024 100755 --- a/main/exercise/matching.class.php +++ b/main/exercise/matching.class.php @@ -14,8 +14,8 @@ */ class Matching extends Question { - static $typePicture = 'matching.png'; - static $explanationLangVar = 'Matching'; + public static $typePicture = 'matching.png'; + public static $explanationLangVar = 'Matching'; /** * Constructor diff --git a/main/exercise/multiple_answer.class.php b/main/exercise/multiple_answer.class.php index cdc8414934..314bd8d2c4 100755 --- a/main/exercise/multiple_answer.class.php +++ b/main/exercise/multiple_answer.class.php @@ -12,8 +12,8 @@ **/ class MultipleAnswer extends Question { - static $typePicture = 'mcma.png'; - static $explanationLangVar = 'MultipleSelect'; + public static $typePicture = 'mcma.png'; + public static $explanationLangVar = 'MultipleSelect'; /** * Constructor diff --git a/main/exercise/multiple_answer_combination.class.php b/main/exercise/multiple_answer_combination.class.php index bd2fd1ee45..f3e7dfb9ce 100755 --- a/main/exercise/multiple_answer_combination.class.php +++ b/main/exercise/multiple_answer_combination.class.php @@ -13,8 +13,8 @@ **/ class MultipleAnswerCombination extends Question { - static $typePicture = 'mcmac.png'; - static $explanationLangVar = 'MultipleSelectCombination'; + public static $typePicture = 'mcmac.png'; + public static $explanationLangVar = 'MultipleSelectCombination'; /** * Constructor diff --git a/main/exercise/multiple_answer_combination_true_false.class.php b/main/exercise/multiple_answer_combination_true_false.class.php index 51a2b0c851..cfe81b23fd 100755 --- a/main/exercise/multiple_answer_combination_true_false.class.php +++ b/main/exercise/multiple_answer_combination_true_false.class.php @@ -12,9 +12,9 @@ **/ class MultipleAnswerCombinationTrueFalse extends MultipleAnswerCombination { - static $typePicture = 'mcmaco.png'; - static $explanationLangVar = 'MultipleAnswerCombinationTrueFalse'; - var $options; + public static $typePicture = 'mcmaco.png'; + public static $explanationLangVar = 'MultipleAnswerCombinationTrueFalse'; + public $options; /** * Constructor diff --git a/main/exercise/multiple_answer_true_false.class.php b/main/exercise/multiple_answer_true_false.class.php index 093895add4..572339af65 100755 --- a/main/exercise/multiple_answer_true_false.class.php +++ b/main/exercise/multiple_answer_true_false.class.php @@ -11,8 +11,8 @@ */ class MultipleAnswerTrueFalse extends Question { - static $typePicture = 'mcmao.png'; - static $explanationLangVar = 'MultipleAnswerTrueFalse'; + public static $typePicture = 'mcmao.png'; + public static $explanationLangVar = 'MultipleAnswerTrueFalse'; public $options; /** diff --git a/main/exercise/oral_expression.class.php b/main/exercise/oral_expression.class.php index 49c3634dd1..ca8eae1d90 100755 --- a/main/exercise/oral_expression.class.php +++ b/main/exercise/oral_expression.class.php @@ -11,9 +11,8 @@ */ class OralExpression extends Question { - static $typePicture = 'audio_question.png'; - static $explanationLangVar = 'OralExpression'; - + public static $typePicture = 'audio_question.png'; + public static $explanationLangVar = 'OralExpression'; private $sessionId; private $userId; private $exerciseId; @@ -21,7 +20,6 @@ class OralExpression extends Question private $storePath; private $fileName; private $filePath; - public $available_extensions = array('wav', 'ogg'); /** diff --git a/main/exercise/unique_answer.class.php b/main/exercise/unique_answer.class.php index 144767145a..788da5e8f5 100755 --- a/main/exercise/unique_answer.class.php +++ b/main/exercise/unique_answer.class.php @@ -14,15 +14,14 @@ **/ class UniqueAnswer extends Question { - static $typePicture = 'mcua.png'; - static $explanationLangVar = 'UniqueSelect'; + public static $typePicture = 'mcua.png'; + public static $explanationLangVar = 'UniqueSelect'; /** * Constructor */ public function __construct() { - //this is highly important parent::__construct(); $this->type = UNIQUE_ANSWER; $this->isContent = $this->getIsContent(); diff --git a/main/exercise/unique_answer_no_option.class.php b/main/exercise/unique_answer_no_option.class.php index 0199562405..47fd3c9797 100755 --- a/main/exercise/unique_answer_no_option.class.php +++ b/main/exercise/unique_answer_no_option.class.php @@ -12,15 +12,14 @@ */ class UniqueAnswerNoOption extends Question { - static $typePicture = 'mcuao.png'; - static $explanationLangVar = 'UniqueAnswerNoOption'; + public static $typePicture = 'mcuao.png'; + public static $explanationLangVar = 'UniqueAnswerNoOption'; /** * Constructor */ public function __construct() { - //this is highly important parent::__construct(); $this -> type = UNIQUE_ANSWER_NO_OPTION; $this -> isContent = $this-> getIsContent();