Exercises: Fix queries with iid

pull/3741/head
Julio Montoya 4 years ago
parent bdb420b8c5
commit 48aeb9e6b9
  1. 2
      assets/js/app.js
  2. 11
      public/main/exercise/hotspot_answers.as.php
  3. 2
      public/main/inc/lib/javascript/hotspot/js/hotspot.js
  4. 1
      src/CoreBundle/Resources/views/Layout/base-layout.html.twig

@ -49,7 +49,7 @@ var connect_lang = 'ChatConnected';
var disconnect_lang = 'ChatDisconnected';
$(function () {
var webCidReq = '&cidReq=' + $('body').attr('data-course-code');
var webCidReq = '&cid=' + $('body').attr('data-course-id') + '&sid=' + $('body').attr('data-session-id');
window.webCidReq = webCidReq;
$("#menu_courses").click(function(){

@ -53,6 +53,9 @@ if (!api_is_allowed_to_edit(null, true)) {
$questionRepo = Container::getQuestionRepository();
/** @var CQuizQuestion $objQuestion */
$objQuestion = $questionRepo->find($questionId);
if (empty($objQuestion)) {
exit;
}
$answer_type = $objQuestion->getType(); //very important
$TBL_ANSWERS = Database::get_course_table(TABLE_QUIZ_ANSWER);
@ -60,11 +63,11 @@ $TBL_ANSWERS = Database::get_course_table(TABLE_QUIZ_ANSWER);
$resourceFile = $objQuestion->getResourceNode()->getResourceFile();
$pictureWidth = $resourceFile->getWidth();
$pictureHeight = $resourceFile->getHeight();
$imagePath = $questionRepo->getHotSpotImageUrl($objQuestion);
$imagePath = $questionRepo->getHotSpotImageUrl($objQuestion).'?'.api_get_cidreq();
$objExercise->read($exerciseId);
if (empty($objQuestion) || empty($objExercise)) {
if (empty($objExercise)) {
exit;
}
@ -143,11 +146,11 @@ if (in_array(
$hotSpotWithAnswer = [];
$data['answers'] = [];
$rs = $em
->getRepository('ChamiloCoreBundle:TrackEHotspot')
->getRepository(TrackEHotspot::class)
->findBy(
[
'hotspotQuestionId' => $questionId,
'cId' => $courseId,
'course' => $courseId,
'hotspotExeId' => $exeId,
],
['hotspotAnswerId' => 'ASC']

@ -1,10 +1,10 @@
// webCidReq is defined in the <body tag>
window.HotspotQuestion = (function () {
return function (settings) {
var HotspotModel = function (attributes) {
this.attributes = attributes;
this.id = 0;
this.name = '';
this.changeEvent = null;
};
HotspotModel.prototype.set = function (key, value) {

@ -16,6 +16,7 @@
<body
class="{{ section_name }}"
data-in-course="{{ course ? 'true' : 'false' }}"
data-course-id="{{ course ? course.id : '' }}"
data-course-code="{{ course ? course.code : '' }}"
data-session-id="{{ session ? session.id : '' }}"
>

Loading…
Cancel
Save