[svn r20351] partial correct test hotspot in exercise see FS#4050

skala
Carlos Vargas 17 years ago
parent bbd87b01d9
commit 370d561dea
  1. 43
      main/exercice/exercice_submit.php
  2. 1001
      main/exercice/exercise_result.php
  3. 29
      main/exercice/exercise_show.php
  4. 22
      main/exercice/hotspot.class.php
  5. 23
      main/exercice/hotspot.inc.php
  6. 23
      main/exercice/hotspot_actionscript.as.php
  7. 23
      main/exercice/hotspot_actionscript_admin.as.php
  8. 23
      main/exercice/hotspot_admin.inc.php
  9. 36
      main/exercice/hotspot_answers.as.php
  10. 23
      main/exercice/hotspot_lang_conversion.php
  11. 25
      main/exercice/hotspot_save.inc.php
  12. 22
      main/exercice/hotspot_savescore.inc.php
  13. 22
      main/exercice/hotspot_updatescore.inc.php

@ -1,5 +1,5 @@
<?php
// $Id: exercice_submit.php 20252 2009-05-02 20:56:25Z iflorespaz $
// $Id: exercice_submit.php 20351 2009-05-05 23:59:13Z cvargas1 $
/*
==============================================================================
@ -43,7 +43,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert
* @author Julio Montoya multiple fill in blank option added
* @version $Id: exercice_submit.php 20252 2009-05-02 20:56:25Z iflorespaz $
* @version $Id: exercice_submit.php 20351 2009-05-05 23:59:13Z cvargas1 $
*/
include ('exercise.class.php');
@ -103,11 +103,9 @@ if (empty ($formSent)) {
if (empty ($exerciseResult)) {
$exerciseResult = $_REQUEST['exerciseResult'];
}
if (empty ($exerciseResultCoordinates)) {
$exerciseResultCoordinates = $_REQUEST['exerciseResultCoordinates'];
}
if (empty ($exerciseType)) {
$exerciseType = $_REQUEST['exerciseType'];
}
@ -183,6 +181,7 @@ if ($origin == 'builder') {
unset ($exerciseResultCoordinates);
}
}
$safe_lp_id = ($learnpath_id == '') ? 0 : (int) $learnpath_id;
$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : (int) $learnpath_item_id;
$condition = ' WHERE ' .
@ -243,7 +242,8 @@ if ($formSent) {
echo str_repeat('&nbsp;', 0) . '$choice is an array' . "<br />\n";
}
if ($exerciseType == 1) {
if ($exerciseType == 1)
{
// $exerciseResult receives the content of the form.
// Each choice of the student is stored into the array $choice
$exerciseResult = $choice;
@ -251,6 +251,7 @@ if ($formSent) {
if (isset ($_POST['hotspot'])) {
$exerciseResultCoordinates = $_POST['hotspot'];
}
} else {
// gets the question ID from $choice. It is the key of the array
list ($key) = array_keys($choice);
@ -308,7 +309,7 @@ if ($formSent) {
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = $objAnswerTmp->selectWeighting($answerId);
switch ($answerType) {
// for unique answer
case UNIQUE_ANSWER :
@ -505,13 +506,10 @@ if ($formSent) {
$questionScore += $answerWeighting;
$totalScore += $answerWeighting;
}
$tbl_track_e_hotspot = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Save into db
$sql = "INSERT INTO $tbl_track_e_hotspot (`hotspot_user_id` , `hotspot_course_code` , `hotspot_exe_id` , `hotspot_question_id` , `hotspot_answer_id` , `hotspot_correct` , `hotspot_coordinate` )
VALUES ('" . Database :: escape_string($_user['user_id']) . "', '" . Database :: escape_string($_course['id']) . "', '" . Database :: escape_string($exeId) . "', '" . Database :: escape_string($questionId) . "', '" . Database :: escape_string($answerId) . "', '" . Database :: escape_string($studentChoice) . "', '" . Database :: escape_string($_SESSION['exerciseResultCoordinates'][$questionId][$answerId]) . "')";
$result = api_sql_query($sql, __FILE__, __LINE__);
VALUES ('" . Database :: escape_string($_user['user_id']) . "', '" . Database :: escape_string($_course['id']) . "', '" . Database :: escape_string($exeId) . "', '" . Database :: escape_string($questionId) . "', '" . Database :: escape_string($answerId) . "', '" . Database :: escape_string($studentChoice) . "', '" . Database :: escape_string($_SESSION['exerciseResultCoordinates'][$questionId][$answerId]) . "')";
$result = api_sql_query($sql, __FILE__, __LINE__);
break;
// for hotspot with fixed order
case HOT_SPOT_ORDER :
@ -527,7 +525,6 @@ if ($formSent) {
break;
} // end switch Answertype
} // end for that loops over all answers of the current question
// destruction of Answer
unset ($objAnswerTmp);
@ -572,12 +569,10 @@ if ($formSent) {
exercise_attempt($questionScore, $answer, $quesId, $exeId, $j);
}
}
elseif ($answerType == FREE_ANSWER) {
} elseif ($answerType == FREE_ANSWER) {
$answer = $choice;
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0);
}
elseif ($answerType == UNIQUE_ANSWER) {
} elseif ($answerType == UNIQUE_ANSWER) {
$sql = "select id from $table_ans where question_id='" . Database :: escape_string($questionId) . "' and position='" . Database :: escape_string($choice) . "'";
$res = api_sql_query($sql, __FILE__, __LINE__);
$answer = Database :: result($res, 0, "id");
@ -612,22 +607,23 @@ 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) {
define('ALL_ON_ONE_PAGE',1);
define('ONE_PER_PAGE',2);
// if all questions on one page OR if it is the last question (only for an exercise with one question per page)
if ($exerciseType == ALL_ON_ONE_PAGE || $questionNum >= $nbrQuestions) {
if ($debug > 0) {
echo str_repeat('&nbsp;', 0) . 'Redirecting to exercise_result.php - Remove debug option to let this happen' . "<br />\n";
}
// goes to the script that will show the result of the exercise
if ($exerciseType == 1) {
header("Location: exercise_result.php?exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
if ($exerciseType == ALL_ON_ONE_PAGE) {
header("Location: exercise_result.php?id=$exe_id&exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
} else {
if ($exe_id != '') {
//clean incomplete
$update_query = 'UPDATE ' . $stat_table . ' SET ' . "status = '', data_tracking='', exe_date = '" . date('Y-m-d H:i:s') . "'" . ' WHERE exe_id = ' . $exe_id;
api_sql_query($update_query, __FILE__, __LINE__);
}
header("Location: exercise_show.php?id=$exeId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
header("Location: exercise_show.php?id=$exe_id&exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
}
exit ();
}
@ -1013,7 +1009,8 @@ if (!empty ($error)) {
}
$s = "<p>$exerciseDescription</p>";
if ($exerciseType == 2) {
if ($exerciseType == 2)
{
$s2 = "&exerciseId=" . $exerciseId;
}

File diff suppressed because it is too large Load Diff

@ -4,7 +4,7 @@
*
* @package dokeos.exercise
* @author Julio Montoya Armas Added switchable fill in blank option added
* @version $Id: exercise_show.php 20331 2009-05-05 15:17:55Z juliomontoya $
* @version $Id: exercise_show.php 20351 2009-05-05 23:59:13Z cvargas1 $
*
* @todo remove the debug code and use the general debug library
* @todo use the Database:: functions
@ -19,18 +19,10 @@ include('../inc/global.inc.php');
include('../inc/lib/course.lib.php');
// including additional libraries
include_once('exercise.class.php');
include_once('question.class.php');
include_once('question.class.php'); //also defines answer type constants
include_once('answer.class.php');
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
// answer types
define('UNIQUE_ANSWER', 1);
define('MULTIPLE_ANSWER', 2);
define('FILL_IN_BLANKS', 3);
define('MATCHING', 4);
define('FREE_ANSWER', 5);
define('HOTSPOT', 6);
if ( empty ( $origin ) ) {
$origin = $_REQUEST['origin'];
}
@ -875,7 +867,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
echo '</tr>';
}
echo '</table>';
} else if($answerType == HOTSPOT) {
} else if($answerType == HOT_SPOT) {
?>
<table width="355" border="0">
<tr>
@ -888,7 +880,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
?>
<tr>
<td valign="top" align="left" style="padding-left:0px;" >
<table style="border: 1px solid #4271b5;border-bottom:none" width="556px">
<table style="border: 1px solid #A4A4A4;border-bottom:none" width="556px">
<?php
for($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
@ -911,13 +903,12 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
?>
</table>
</td></tr>
<?php
echo '
<tr>
<td colspan="2">
<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=0" width="556" height="421">
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=1" />
<?php
echo '<tr>
<td colspan="2">'.
//<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=1" width="556" height="421">
'<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.Security::remove_XSS($questionId).'&exe_id='.$id.'&from_db=0" width="556" height="421">
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.Security::remove_XSS($questionId).'&exe_id='.$id.'&from_db=0" />
</object>
</td>

@ -1,22 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* File containing the HotSpot class.

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* Hotspot languae conversion
* @package dokeos.exercise

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file generates the ActionScript variables code used by the HotSpot .swf
* @package dokeos.exercise

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file generates the ActionScript variables code used by the HotSpot .swf
* @package dokeos.exercise

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This script allows to manage answers. It is included from the script admin.php
* @package dokeos.exercise

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file generates the ActionScript variables code used by the HotSpot .swf
* @package dokeos.exercise
@ -102,15 +85,11 @@ $questionId = $_GET['modifyAnswers'];
$course_code = $_course['id'];
// Get clicks
if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0)
{
foreach ($_SESSION['exerciseResultCoordinates'][$questionId] as $coordinate)
{
if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0) {
foreach ($_SESSION['exerciseResultCoordinates'][$questionId] as $coordinate) {
$output2 .= $coordinate."|";
}
}
else
{
} else {
// get it from db
$tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$sql = 'SELECT hotspot_coordinate
@ -120,8 +99,7 @@ else
AND hotspot_exe_id='.intval($exe_id);
$rs = @api_sql_query($sql); // don't output error because we are in Flash execution.
while($row = Database :: fetch_array($rs))
{
while($row = Database :: fetch_array($rs)) {
$output2 .= $row['hotspot_coordinate']."|";
}
}

@ -1,23 +1,6 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* Hotspot languae conversion
* @package dokeos.exercise

@ -1,25 +1,8 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file generates the ActionScript code used by the HotSpot .swf
*
* @package dokeos.exercise
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $

@ -1,23 +1,7 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file saves every click in the hotspot tool into track_e_hotspots
* @package dokeos.exercise

@ -1,23 +1,7 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
<?php //$id:$
/* For licensing terms, see /dokeos_license.txt */
//error_log(__FILE__);
/**
* This file saves every click in the hotspot tool into track_e_hotspots
* @package dokeos.exercise

Loading…
Cancel
Save