Using iid for hotspots - refs BT#11764

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent e65e49a769
commit ec0df618a2
  1. 9
      main/exercise/hotspot_actionscript.as.php
  2. 7
      main/exercise/hotspot_answers.as.php
  3. 1
      main/inc/lib/events.lib.php
  4. 9
      main/inc/lib/javascript/hotspot/js/hotspot.js

@ -32,11 +32,11 @@ $course_id = api_get_course_int_id();
// Query db for answers
if ($answer_type==HOT_SPOT_DELINEATION) {
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id";
$sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY iid";
} else {
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id";
$sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY iid";
}
$result = Database::query($sql);
@ -74,6 +74,7 @@ while ($hotspot = Database::fetch_assoc($result))
{
$hotSpot = [];
$hotSpot['id'] = $hotspot['id'];
$hotSpot['iid'] = $hotspot['iid'];
$hotSpot['answer'] = $hotspot['answer'];
// Square or rectancle

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CQuizAnswer;
use Chamilo\CoreBundle\Entity\TrackEHotspot;
/**
* This file generates the ActionScript variables code used by the
* HotSpot .swf
@ -76,9 +79,10 @@ if ($objExercise->results_disabled != RESULT_DISABLE_SHOW_SCORE_ONLY) {
->getQuery()
->getResult();
/** @var CQuizAnswer $hotspotAnswer */
foreach ($result as $hotspotAnswer) {
$hotSpot = [];
$hotSpot['id'] = $hotspotAnswer->getId();
$hotSpot['id'] = $hotspotAnswer->getIid();
$hotSpot['answer'] = $hotspotAnswer->getAnswer();
switch ($hotspotAnswer->getHotspotType()) {
@ -118,6 +122,7 @@ $rs = $em
['hotspotId' => 'ASC']
);
/** @var TrackEHotspot $row */
foreach ($rs as $row) {
$data['answers'][] = $row->getHotspotCoordinate();
}

@ -623,7 +623,6 @@ class Event
api_get_user_id(),
$exe_id,
$question_id,
$answer_id,
$answer_id
)
)

@ -53,7 +53,6 @@ window.HotspotQuestion = (function () {
this.set('height', y - startY);
}
};
SquareModel.decode = function (hotspotInfo) {
var coords = hotspotInfo.coord.split('|'),
position = coords[0].split(';'),
@ -64,7 +63,7 @@ window.HotspotQuestion = (function () {
height: parseInt(coords[2])
});
hotspot.id = hotspotInfo.id;
hotspot.id = hotspotInfo.iid;
hotspot.name = hotspotInfo.answer;
return hotspot;
@ -124,7 +123,7 @@ window.HotspotQuestion = (function () {
radiusY: parseInt(coords[2])
});
hotspot.id = hotspotInfo.id;
hotspot.id = hotspotInfo.iid;
hotspot.name = hotspotInfo.answer;
return hotspot;
@ -170,7 +169,7 @@ window.HotspotQuestion = (function () {
var hotspot = new PolygonModel({
points: points
});
hotspot.id = hotspotInfo.id;
hotspot.id = hotspotInfo.iid;
hotspot.name = hotspotInfo.answer;
return hotspot;
@ -269,7 +268,6 @@ window.HotspotQuestion = (function () {
self.render();
});
};
HotspotSVG.prototype.render = function () {
var newEl = null;
@ -323,7 +321,6 @@ window.HotspotQuestion = (function () {
self.render();
});
};
AnswerSVG.prototype.render = function () {
this.circleEl.setAttribute('cx', this.model.get('x'));
this.circleEl.setAttribute('cy', this.model.get('y'));

Loading…
Cancel
Save