[svn r10110] updates for making hotspot works (some things don't work yet)

skala
Luk Vanlanduyt 19 years ago
parent 63923e4ce7
commit 78d8d6762f
  1. 6
      main/exercice/answer.class.php
  2. 9
      main/exercice/answer_admin.inc.php
  3. 24
      main/exercice/exercice_submit.php
  4. 3
      main/exercice/exercise_result.php
  5. 3
      main/exercice/hotspot_actionscript.as.php
  6. 3
      main/exercice/hotspot_actionscript_admin.as.php
  7. 7
      main/exercice/hotspot_answers.as.php
  8. 3
      main/exercice/hotspot_savescore.inc.php
  9. 2
      main/inc/lib/main_api.lib.php
  10. 109
      main/plugin/hotspot/hotspot.js
  11. BIN
      main/plugin/hotspot/hotspot_admin.swf
  12. BIN
      main/plugin/hotspot/hotspot_user.swf

@ -1,4 +1,4 @@
<?php // $Id: answer.class.php 9665 2006-10-24 10:43:48Z elixir_inter $
<?php // $Id: answer.class.php 10110 2006-11-22 15:20:46Z develop-it $
/*
==============================================================================
Dokeos - elearning and course management software
@ -117,7 +117,7 @@ class Answer
$questionId=$this->questionId;
//$answerType=$this->selectType();
$sql="SELECT answer,correct,comment,ponderation,position FROM $TBL_ANSWER WHERE question_id='$questionId' ORDER BY position";
$sql="SELECT answer,correct,comment,ponderation,position, hotspot_coordinates, hotspot_type FROM $TBL_ANSWER WHERE question_id='$questionId' ORDER BY position";
$result=api_sql_query($sql,__FILE__,__LINE__);
@ -160,7 +160,7 @@ $this->hotspot_coordinates[$i]=$object->hotspot_coordinates;
$questionId=$this->questionId;
//$answerType=$this->selectType();
$sql="SELECT answer,correct,comment,ponderation,position " .
$sql="SELECT answer,correct,comment,ponderation,position, hotspot_coordinates, hotspot_type " .
"FROM $TBL_ANSWER " .
"WHERE question_id='$questionId' " .
"ORDER BY $field $order";

@ -1,4 +1,4 @@
<?php // $Id: answer_admin.inc.php 9973 2006-11-14 14:53:22Z pcool $
<?php // $Id: answer_admin.inc.php 10110 2006-11-22 15:20:46Z develop-it $
/*
==============================================================================
Dokeos - elearning and course management software
@ -76,6 +76,7 @@ if($modifyIn)
$objAnswer->duplicate($questionId);
// construction of the duplicated Answers
$objAnswer=new Answer($questionId);
}
@ -604,10 +605,10 @@ if($modifyAnswers)
if($debug>0){echo str_repeat('&nbsp;',0).'$modifyAnswers is set'."<br />\n";}
// construction of the Answer object
$objAnswer=new Answer($questionId);
api_session_register('objAnswer');
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER)
@ -831,7 +832,7 @@ if($modifyAnswers)
}
$_SESSION['tmp_answers']=array();
$_SESSION['tmp_answers'] = array();
$_SESSION['tmp_answers']['answer'] = $reponse;
$_SESSION['tmp_answers']['comment'] = $comment;
$_SESSION['tmp_answers']['weighting'] = $weighting;

@ -1,4 +1,4 @@
<?php // $Id: exercice_submit.php 9972 2006-11-14 14:44:37Z pcool $
<?php // $Id: exercice_submit.php 10110 2006-11-22 15:20:46Z develop-it $
/*
==============================================================================
Dokeos - elearning and course management software
@ -92,6 +92,11 @@ if ( empty ( $formSent ) ) {
if ( empty ( $exerciseResult ) ) {
$exerciseResult = $_REQUEST['exerciseResult'];
}
if ( empty ( $exerciseResultCoordinates ) ) {
$exerciseResultCoordinates = $_REQUEST['exerciseResultCoordinates'];
}
if ( empty ( $exerciseType ) ) {
$exerciseType = $_REQUEST['exerciseType'];
}
@ -128,6 +133,7 @@ if ($origin=='builder') {
if(isset($_SESSION['objAnswer'])) { api_session_unregister('objAnswer'); unset($objAnswer); }
if(isset($_SESSION['questionList'])) { api_session_unregister('questionList'); unset($questionList); }
if(isset($_SESSION['exerciseResult'])) { api_session_unregister('exerciseResult'); unset($exerciseResult); }
if(isset($_SESSION['exerciseResultCoordinates'])) { api_session_unregister('exerciseResultCoordinates'); unset($exerciseResultCoordinates); }
}
// if the user has submitted the form
@ -139,6 +145,7 @@ if($formSent)
if(!is_array($exerciseResult))
{
$exerciseResult=array();
$exerciseResultCoordinates=array();
}
// if the user has answered at least one question
@ -151,6 +158,11 @@ if($formSent)
// $exerciseResult receives the content of the form.
// Each choice of the student is stored into the array $choice
$exerciseResult=$choice;
if (isset($_POST['hotspot']))
{
$exerciseResultCoordinates = $_POST['hotspot'];
}
}
else
{
@ -162,6 +174,11 @@ if($formSent)
{
// stores the user answer into the array
$exerciseResult[$key]=$choice[$key];
if (isset($_POST['hotspot']))
{
$exerciseResultCoordinates[$key] = $_POST['hotspot'][$key];
}
}
}
if($debug>0){echo str_repeat('&nbsp;',0).'$choice is an array - end'."<br />\n";}
@ -169,6 +186,7 @@ if($formSent)
// the script "exercise_result.php" will take the variable $exerciseResult from the session
api_session_register('exerciseResult');
api_session_register('exerciseResultCoordinates');
// if it is the last question (only for a sequential exercise)
if($exerciseType == 1 || $questionNum >= $nbrQuestions)
@ -245,8 +263,8 @@ if(!$questionNum || $_POST['questionNum'])
$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
if ($origin != 'learnpath') { //so we are not in learnpath tool
$htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../js/JavaScriptFlashGateway.js\"></script>
<script src=\"../js/hotspot.js\" type=\"text/javascript\"></script>
$htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/JavaScriptFlashGateway.js\"></script>
<script src=\"../plugin/hotspot/hotspot.js\" type=\"text/javascript\"></script>
<script language=\"JavaScript\" type=\"text/javascript\">
<!--
// -----------------------------------------------------------------------------

@ -1,4 +1,4 @@
<?php // $Id: exercise_result.php 10082 2006-11-21 19:08:15Z pcool $
<?php // $Id: exercise_result.php 10110 2006-11-22 15:20:46Z develop-it $
/*
==============================================================================
Dokeos - elearning and course management software
@ -43,7 +43,6 @@
INIT SECTION
==============================================================================
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');

@ -54,13 +54,14 @@
$courseLang = $_course['language'];
$courseCode = $_course['sysCode'];
$coursePath = $_course['path'];
// Query db for answers
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM `$TBL_ANSWERS` WHERE question_id = '$questionId' ORDER BY id";
$result = api_sql_query($sql,__FILE__,__LINE__);
// Init
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$courseCode";
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$coursePath";
$i = 0;
$nmbrTries = 0;

@ -54,13 +54,14 @@
$courseLang = $_course['language'];
$courseCode = $_course['sysCode'];
$coursePath = $_course['path'];
// Query db for answers
//$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM `$TBL_ANSWERS` WHERE question_id = '$questionId' ORDER BY id";
//$result = api_sql_query($sql,__FILE__,__LINE__);
// Init
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$courseCode";
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$coursePath";
$i = 0;
$nmbrTries = 0;

@ -41,6 +41,9 @@
// set vars
$userId = $_user['user_id'];
$questionId = $_GET['modifyAnswers'];
$questionId = 7;
$objQuestion = new Question();
$objQuestion->read($questionId);
@ -57,13 +60,14 @@
$courseLang = $_course['language'];
$courseCode = $_course['sysCode'];
$coursePath = $_course['path'];
// Query db for answers
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM `$TBL_ANSWERS` WHERE question_id = '$questionId' ORDER BY id";
$result = api_sql_query($sql,__FILE__,__LINE__);
// Init
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$courseCode";
$output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&dbNameGlu=$dbNameGlu&courseCode=$coursePath";
$i = 0;
while ($hotspot = mysql_fetch_array($result)) {
@ -111,6 +115,7 @@
$output2 .= $coordinate."|";
}
var_dump($_SESSION['exerciseResultCoordinates']);
// Output
$output .= "&p_hotspot_answers=".substr($output2,0,-1)."&done=done";

@ -62,10 +62,11 @@
}
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS);
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS);
// Save into db
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (`user_id` , `course_id` , `quiz_id` , `question_id` , `answer_id` , `correct` , `coordinate` ) VALUES ('".$_user['user_id']."', '$courseCode', '$exerciseId', '$questionId', '$answerId', '$hit', '$coordinates')";
$result = api_sql_query($sql,__FILE__,__LINE__);
// Save insert id into session if users changes answer.

@ -492,7 +492,7 @@ function api_get_course_info()
function api_sql_query($query, $file = '', $line = 0)
{
$result = mysql_query($query);
if ($line && !$result)
{
if (api_get_setting('server_type') !== 'test')

@ -1,53 +1,58 @@
// in je FORM-tag voor de hotspots: onSubmit="return validateFlashVar('MINIMUM_AANTAL_CLICKS');
var flashVar = 0;
var lcId = new Date().getTime();
var flashProxy = new FlashProxy(lcId, "JavaScriptFlashGateway.swf");
function validateFlashVar(counter, lang_1, lang_2)
{
if (counter!=flashVar)
{
alert (lang_1 + counter + lang_2);
return false;
}
else
{
return true;
}
}
function updateFlashVar()
{
flashVar++;
}
function saveHotspot(question_id, hotspot_id, answer, hotspot_x, hotspot_y)
{
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = hotspot_x + ";" + hotspot_y;
document.frm_exercise.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
document.frm_exercise.appendChild(newHotspot);
}
function saveShapeHotspot(question_id, hotspot_id, type, x, y, w, h)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = x + ";" + y + "|" + w + "|" + h;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = type;
}
function savePolyHotspot(question_id, hotspot_id, coordinates)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = coordinates;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = "poly";
// in je FORM-tag voor de hotspots: onSubmit="return validateFlashVar('MINIMUM_AANTAL_CLICKS');
var flashVar = 0;
var lcId = new Date().getTime();
//var flashProxy = new FlashProxy(lcId, "JavaScriptFlashGateway.swf");
function validateFlashVar(counter, lang_1, lang_2)
{
//alert(counter);
//alert(flashVar);
if(counter!=flashVar)
{
//alert (lang_1 + counter + lang_2);
alert (lang_1);
return false;
}
else
{
return true;
}
}
function updateFlashVar()
{
//alert('updateFlashVar: ' + flashVar);
flashVar++;
}
function saveHotspot(question_id, hotspot_id, answer, hotspot_x, hotspot_y)
{
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = hotspot_x + ";" + hotspot_y;
document.frm_exercise.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
document.frm_exercise.appendChild(newHotspot);
}
function saveShapeHotspot(question_id, hotspot_id, type, x, y, w, h)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = x + ";" + y + "|" + w + "|" + h;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = type;
}
function savePolyHotspot(question_id, hotspot_id, coordinates)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = coordinates;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = "poly";
}
Loading…
Cancel
Save