1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- use ChamiloSession as Session;
- require_once __DIR__.'/../inc/global.inc.php';
- api_protect_course_script(true);
- $courseCode = $_GET['coursecode'];
- $questionId = $_GET['questionId'];
- $coordinates = $_GET['coord'];
- $objExercise = Session::read('objExercise');
- $hotspotId = $_GET['hotspotId'];
- $exerciseId = $objExercise->selectId();
- if ($_GET['answerId'] == "0") {
- $hit = 0;
- $answerId = $hotspotId;
-
- unset($_SESSION['exerciseResult'][$questionId][$answerId]);
- } else {
- $hit = 1;
- $answerId = $hotspotId;
-
- $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
- }
- $coords = explode('/', $coordinates);
- $coordinates = '';
- foreach ($coords as $coord) {
- list($x, $y) = explode(';', $coord);
- $coordinates .= round($x).';'.round($y).'/';
- }
- $coordinates = substr($coordinates, 0, -1);
- $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
- $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];
- $sql = "UPDATE $TBL_TRACK_E_HOTSPOT
- SET coordinate = '".Database::escape_string($coordinates)."'
- WHERE id = ".intval($update_id)."
- LIMIT 1";
- $result = Database::query($sql);
|