Minor - fixing PHP warnings.

1.9.x
Julio Montoya 11 years ago
parent d66f76ea28
commit 0daf812ba3
  1. 8
      main/exercice/admin.php
  2. 6
      main/exercice/answer.class.php
  3. 11
      main/exercice/export/exercise_import.inc.php
  4. 2
      main/exercice/question.class.php

@ -497,12 +497,12 @@ if (isset($_GET['message'])) {
if ($newQuestion || $editQuestion) {
// statement management
$type = Security::remove_XSS($_REQUEST['answerType']);
$type = isset($_REQUEST['answerType']) ? Security::remove_XSS($_REQUEST['answerType']) : null;
echo '<input type="hidden" name="Type" value="'.$type.'" />';
if ($newQuestion == 'yes') {
$objExercise->edit_exercise_in_lp = true;
}
if ($newQuestion == 'yes') {
$objExercise->edit_exercise_in_lp = true;
}
require 'question_admin.inc.php';
}

@ -73,7 +73,8 @@ class Answer
// fills arrays
$objExercise = new Exercise($this->course_id);
$objExercise->read($_REQUEST['exerciseId']);
$exerciseId = isset($_REQUEST['exerciseId']) ? $_REQUEST['exerciseId'] : null;
$objExercise->read($exerciseId);
if ($objExercise->random_answers == '1') {
$this->readOrderedBy('rand()', '');// randomize answers
} else {
@ -533,7 +534,8 @@ class Answer
$sql.="($c_id, '$i','$questionId','$answer','$correct','$comment','$weighting','$position','$hotspot_coordinates','$hotspot_type','$destination'),";
} else {
// https://support.chamilo.org/issues/6558
// function updateAnswers already escape_string, error if we do it twice. Feed function updateAnswers with none escaped strings
// function updateAnswers already escape_string, error if we do it twice.
// Feed function updateAnswers with none escaped strings
$this->updateAnswers(
$this->new_answer[$i],
$this->new_comment[$i],

@ -161,10 +161,13 @@ function import_exercise($file)
foreach ($question_array['answer'] as $key => $answers) {
$split = explode('_', $key);
$i = $split[1];
$answer->new_answer[$i] = $answers['value']; // answer ...
$answer->new_comment[$i] = $answers['feedback']; // comment ...
$answer->new_position[$i] = $i; // position ...
// correct answers ...
// Answer
$answer->new_answer[$i] = $answers['value'];
// Comment
$answer->new_comment[$i] = isset($answers['feedback']) ? $answers['feedback'] : null;
// Position
$answer->new_position[$i] = $i;
// Correct answers
if (in_array($key, $question_array['correct_answers'])) {
$answer->new_correct[$i] = 1;
} else {

@ -1203,7 +1203,7 @@ abstract class Question
// Question type
$answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
$form->addElement('hidden','answerType', $_REQUEST['answerType']);
$form->addElement('hidden','answerType', $answerType);
// html editor
$editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');

Loading…
Cancel
Save