Fix PHP warnings that blocked annotation question see BT#10892

pull/2458/head
jmontoyaa 8 years ago
parent 063ca5cc2a
commit 7f30868194
  1. 18
      main/exercise/annotation_user.php
  2. 2
      main/exercise/answer.class.php
  3. 5
      main/exercise/exercise_show.php
  4. 3
      main/inc/lib/exercise.lib.php
  5. 3
      main/inc/lib/javascript/annotation/js/annotation.js

@ -1,18 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
session_cache_limiter("none");
session_cache_limiter('none');
require_once __DIR__.'/../inc/global.inc.php';
$questionId = isset($_GET['question_id']) ? (int) $_GET['question_id'] : 0;
$exerciseId = isset($_GET['exe_id']) ? (int) $_GET['exe_id'] : 0;
$courseId = isset($_GET['exe_id']) ? (int) $_GET['exe_id'] : 0;
$courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
$courseInfo = api_get_course_info_by_id($courseId);
if (empty($courseInfo)) {
return '';
}
$objQuestion = Question::read($questionId);
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$objQuestion = Question::read($questionId, $courseId);
$documentPath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
$picturePath = $documentPath.'/images';
$pictureSize = getimagesize($picturePath.'/'.$objQuestion->getPictureFilename());
$pictureWidth = $pictureSize[0];
@ -35,10 +38,8 @@ $attemptList = Event::getAllExerciseEventByExeId($exerciseId);
if (!empty($attemptList) && isset($attemptList[$questionId])) {
$questionAttempt = $attemptList[$questionId][0];
if (!empty($questionAttempt['answer'])) {
$answers = explode('|', $questionAttempt['answer']);
foreach ($answers as $answer) {
$parts = explode(')(', $answer);
$type = array_shift($parts);
@ -46,7 +47,6 @@ if (!empty($attemptList) && isset($attemptList[$questionId])) {
switch ($type) {
case 'P':
$points = [];
foreach ($parts as $partPoint) {
$points[] = Geometry::decodePoint($partPoint);
}

@ -1011,11 +1011,13 @@ class Answer
public function isCorrectByAutoId($needle)
{
$key = 0;
if (is_array($this->autoId)) {
foreach ($this->autoId as $autoIdKey => $autoId) {
if ($autoId == $needle) {
$key = $autoIdKey;
}
}
}
if (!$key) {
return false;

@ -613,7 +613,7 @@ foreach ($questionList as $questionId) {
//showing the score
$queryfree = "SELECT marks from ".$TBL_TRACK_ATTEMPT."
WHERE exe_id = ".intval($id)." AND question_id= ".intval($questionId)."";
WHERE exe_id = ".intval($id)." AND question_id= ".intval($questionId);
$resfree = Database::query($queryfree);
$questionScore = Database::result($resfree, 0, "marks");
$totalScore += $questionScore;
@ -664,7 +664,8 @@ foreach ($questionList as $questionId) {
AnnotationQuestion({
questionId: '.(int) $questionId.',
exerciseId: '.(int) $id.',
relPath: \''.$relPath.'\'
relPath: \''.$relPath.'\',
courseId: '.(int) $courseInfo['real_id'].'
});
</script>
';

@ -1298,7 +1298,8 @@ HOTSPOT;
AnnotationQuestion({
questionId: '.$questionId.',
exerciseId: '.$exe_id.',
relPath: \''.$relPath.'\'
relPath: \''.$relPath.'\',
courseId: '.$course_id.',
});
</script>
</div>

@ -337,7 +337,8 @@
$container = $('#annotation-canvas-' + settings.questionId);
$.getJSON(settings.relPath + xhrUrl, {
question_id: parseInt(settings.questionId),
exe_id: parseInt(settings.exerciseId)
exe_id: parseInt(settings.exerciseId),
course_id: parseInt(settings.courseId)
})
.done(function (questionInfo) {
var image = new Image();

Loading…
Cancel
Save