Ckeditor - hotspot fixes.

1.10.x
Julio Montoya 11 years ago
parent 5d351996b3
commit 662238a892
  1. 25
      main/exercice/admin.php
  2. 275
      main/exercice/hotspot_admin.inc.php
  3. 2
      main/exercice/hotspot_save.inc.php
  4. 4
      main/exercice/hotspot_savescore.inc.php
  5. 4
      main/exercice/hotspot_updatescore.inc.php

@ -109,6 +109,7 @@ $cancelExercise = isset($cancelExercise) ? $cancelExercise : null;
$cancelAnswers = isset($cancelAnswers) ? $cancelAnswers : null; $cancelAnswers = isset($cancelAnswers) ? $cancelAnswers : null;
$modifyIn = isset($modifyIn) ? $modifyIn : null; $modifyIn = isset($modifyIn) ? $modifyIn : null;
$cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null; $cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null;
$_course = api_get_course_info();
/* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems /* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems
when changing the exercise settings, number of questions, etc */ when changing the exercise settings, number of questions, etc */
@ -186,8 +187,6 @@ if (!is_object($objExercise)) {
// Exercise can be edited in their course. // Exercise can be edited in their course.
if ($objExercise->sessionId != $sessionId) { if ($objExercise->sessionId != $sessionId) {
api_not_allowed(true); api_not_allowed(true);
/*header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq());
exit;*/
} }
// doesn't select the exercise ID if we come from the question pool // doesn't select the exercise ID if we come from the question pool
@ -216,7 +215,7 @@ if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
} }
// checks if the object exists // checks if the object exists
if(is_object($objQuestion)) { if (is_object($objQuestion)) {
// gets the question ID // gets the question ID
$questionId = $objQuestion->selectId(); $questionId = $objQuestion->selectId();
} }
@ -225,7 +224,7 @@ if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
// if cancelling an exercise // if cancelling an exercise
if ($cancelExercise) { if ($cancelExercise) {
// existing exercise // existing exercise
if($exerciseId) { if ($exerciseId) {
unset($modifyExercise); unset($modifyExercise);
} else { } else {
// new exercise // new exercise
@ -238,14 +237,14 @@ if ($cancelExercise) {
// if cancelling question creation/modification // if cancelling question creation/modification
if ($cancelQuestion) { if ($cancelQuestion) {
// if we are creating a new question from the question pool // if we are creating a new question from the question pool
if(!$exerciseId && !$questionId) { if (!$exerciseId && !$questionId) {
// goes back to the question pool // goes back to the question pool
header('Location: question_pool.php'); header('Location: question_pool.php');
exit(); exit();
} else { } else {
// goes back to the question viewing // goes back to the question viewing
$editQuestion=$modifyQuestion; $editQuestion = $modifyQuestion;
unset($newQuestion,$modifyQuestion); unset($newQuestion, $modifyQuestion);
} }
} }
@ -275,6 +274,7 @@ if ($cancelAnswers) {
$editQuestion=$modifyAnswers; $editQuestion=$modifyAnswers;
unset($modifyAnswers); unset($modifyAnswers);
} }
$nameTools = null; $nameTools = null;
// modifies the query string that is used in the link of tool name // modifies the query string that is used in the link of tool name
if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) { if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
@ -292,16 +292,16 @@ if (!empty($gradebook) && $gradebook=='view') {
); );
} }
$interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices')); $interbreadcrumb[] = array("url" => "exercice.php?".api_get_cidreq(),"name" => get_lang('Exercices'));
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) { if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name); $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id.'&'.api_get_cidreq(), "name" => $objExercise->name);
} else { } else {
$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name); $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
} }
// shows a link to go back to the question pool // shows a link to go back to the question pool
if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){ if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){
$interbreadcrumb[]=array( $interbreadcrumb[] = array(
"url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), "url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(),
"name" => get_lang('QuestionPool') "name" => get_lang('QuestionPool')
); );
@ -309,7 +309,7 @@ if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){
// if the question is duplicated, disable the link of tool name // if the question is duplicated, disable the link of tool name
if ($modifyIn == 'thisExercise') { if ($modifyIn == 'thisExercise') {
if($buttonBack) { if ($buttonBack) {
$modifyIn='allExercises'; $modifyIn='allExercises';
} else { } else {
$noPHP_SELF=true; $noPHP_SELF=true;
@ -332,8 +332,6 @@ function multiple_answer_true_false_onchange(variable) {
} }
document.getElementById(weight_id).value = array_result[result]; document.getElementById(weight_id).value = array_result[result];
} }
</script>'; </script>';
$htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/JavaScriptFlashGateway.js\"></script> $htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/JavaScriptFlashGateway.js\"></script>
@ -523,7 +521,6 @@ if ($newQuestion || $editQuestion) {
if ($newQuestion == 'yes') { if ($newQuestion == 'yes') {
$objExercise->edit_exercise_in_lp = true; $objExercise->edit_exercise_in_lp = true;
} }
require 'question_admin.inc.php'; require 'question_admin.inc.php';
} }

@ -1,14 +1,13 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script allows to manage answers. It is included from the * This script allows to manage answers. It is included from the
* script admin.php * script admin.php
* @package chamilo.exercise * @package chamilo.exercise
* @author Toon Keppens * @author Toon Keppens
*/ */
/**
* Init
*/
use \ChamiloSession as Session; use \ChamiloSession as Session;
$modifyAnswers = intval($_GET['hotspotadmin']); $modifyAnswers = intval($_GET['hotspotadmin']);
@ -21,15 +20,15 @@ $questionName = $objQuestion->selectTitle();
$answerType = $objQuestion->selectType(); $answerType = $objQuestion->selectType();
$pictureName = $objQuestion->selectPicture(); $pictureName = $objQuestion->selectPicture();
$debug = 0; // debug variable to get where we are $debug = 0; // debug variable to get where we are
$okPicture = empty($pictureName) ? false : true; $okPicture = empty($pictureName) ? false : true;
// if we come from the warning box "this question is used in serveral exercises" // if we come from the warning box "this question is used in several exercises"
if ($modifyIn) { if ($modifyIn) {
if ($debug > 0) { if ($debug > 0) {
echo '$modifyIn was set' . "<br />\n"; echo '$modifyIn was set' . "<br />\n";
} }
// if the user has chosed to modify the question only in the current exercise // if the user has chosen to modify the question only in the current exercise
if ($modifyIn == 'thisExercise') { if ($modifyIn == 'thisExercise') {
// duplicates the question // duplicates the question
$questionId = $objQuestion->duplicate(); $questionId = $objQuestion->duplicate();
@ -53,7 +52,6 @@ if ($modifyIn) {
$objAnswer->duplicate($questionId); $objAnswer->duplicate($questionId);
// construction of the duplicated Answers // construction of the duplicated Answers
$objAnswer = new Answer($questionId); $objAnswer = new Answer($questionId);
} }
$color = unserialize($color); $color = unserialize($color);
@ -69,17 +67,16 @@ if ($modifyIn) {
$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
// the answer form has been submitted // the answer form has been submitted
$submitAnswers = isset($_POST['submitAnswers']) ? true : false;
$buttonBack = isset($_POST['buttonBack']) ? true : false;
$nbrAnswers = isset($_POST['nbrAnswers']) ? intval($_POST['nbrAnswers']) : 0;
$submitAnswers = isset($submitAnswers) ? $submitAnswers : false;
$buttonBack = isset($buttonBack) ? $buttonBack : false;
$nbrAnswers = isset($nbrAnswers) ? $nbrAnswers : 0;
if ($submitAnswers || $buttonBack) { if ($submitAnswers || $buttonBack) {
if ($answerType == HOT_SPOT) { if ($answerType == HOT_SPOT) {
if ($debug > 0) { if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set' . "<br />\n"; echo '$submitAnswers or $buttonBack was set' . "<br />\n";
} }
$questionWeighting = $nbrGoodAnswers = 0; $questionWeighting = $nbrGoodAnswers = 0;
for ($i = 1; $i <= $nbrAnswers; $i++) { for ($i = 1; $i <= $nbrAnswers; $i++) {
if ($debug > 0) { if ($debug > 0) {
@ -88,6 +85,7 @@ if ($submitAnswers || $buttonBack) {
$reponse[$i] = trim($reponse[$i]); $reponse[$i] = trim($reponse[$i]);
$comment[$i] = trim($comment[$i]); $comment[$i] = trim($comment[$i]);
$weighting[$i] = $weighting[$i]; // it can be float $weighting[$i] = $weighting[$i]; // it can be float
// checks if field is empty // checks if field is empty
if (empty($reponse[$i]) && $reponse[$i] != '0') { if (empty($reponse[$i]) && $reponse[$i] != '0') {
$msgErr = get_lang('HotspotGiveAnswers'); $msgErr = get_lang('HotspotGiveAnswers');
@ -124,7 +122,15 @@ if ($submitAnswers || $buttonBack) {
$questionWeighting+=$weighting[$i]; $questionWeighting+=$weighting[$i];
} }
// creates answer // creates answer
$objAnswer->createAnswer($reponse[$i], '', $comment[$i], $weighting[$i], $i, $hotspot_coordinates[$i], $hotspot_type[$i]); $objAnswer->createAnswer(
$reponse[$i],
'',
$comment[$i],
$weighting[$i],
$i,
$hotspot_coordinates[$i],
$hotspot_type[$i]
);
} // end for() } // end for()
// saves the answers into the data base // saves the answers into the data base
$objAnswer->save(); $objAnswer->save();
@ -141,7 +147,6 @@ if ($submitAnswers || $buttonBack) {
echo '$modifyIn was set - end' . "<br />\n"; echo '$modifyIn was set - end' . "<br />\n";
} }
} else { } else {
if ($debug > 0) { if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set' . "<br />\n"; echo '$submitAnswers or $buttonBack was set' . "<br />\n";
} }
@ -164,23 +169,25 @@ if ($submitAnswers || $buttonBack) {
$comment[$i] = trim($comment[$i]); $comment[$i] = trim($comment[$i]);
$weighting[$i] = $weighting[$i]; $weighting[$i] = $weighting[$i];
if (empty($threadhold1[$i])) if (empty($threadhold1[$i])) {
$threadhold1_str = 0; $threadhold1_str = 0;
else } else {
$threadhold1_str = intval($threadhold1[$i]); $threadhold1_str = intval($threadhold1[$i]);
}
if (empty($threadhold2[$i])) if (empty($threadhold2[$i])) {
$threadhold2_str = 0; $threadhold2_str = 0;
else } else {
$threadhold2_str = intval($threadhold2[$i]); $threadhold2_str = intval($threadhold2[$i]);
}
if (empty($threadhold3[$i])) if (empty($threadhold3[$i])) {
$threadhold3_str = 0; $threadhold3_str = 0;
else } else {
$threadhold3_str = intval($threadhold3[$i]); $threadhold3_str = intval($threadhold3[$i]);
}
$threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str; $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
//echo '<pre>';print_r($_POST);echo '</pre>';
if ($try[$i] == 'on') { if ($try[$i] == 'on') {
$try_str = 1; $try_str = 1;
@ -207,9 +214,6 @@ if ($submitAnswers || $buttonBack) {
} }
$destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str; $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
// the last answer is the IF NO ERROR section witch has not have the reponse, weight and coordinates values
//if ($i!=$nbrAnswers && !($answerType==HOT_SPOT_DELINEATION))
// {
// checks if field is empty // checks if field is empty
if (empty($reponse[$i]) && $reponse[$i] != '0') { if (empty($reponse[$i]) && $reponse[$i] != '0') {
$msgErr = get_lang('HotspotGiveAnswers'); $msgErr = get_lang('HotspotGiveAnswers');
@ -281,11 +285,29 @@ if ($submitAnswers || $buttonBack) {
$questionWeighting+=$weighting[$i]; $questionWeighting+=$weighting[$i];
} }
// creates answer // creates answer
$objAnswer->createAnswer($reponse[$i], '', $comment[$i], $weighting[$i], $i, $hotspot_coordinates[$i], $hotspot_type[$i], $destination[$i]); $objAnswer->createAnswer(
$reponse[$i],
'',
$comment[$i],
$weighting[$i],
$i,
$hotspot_coordinates[$i],
$hotspot_type[$i],
$destination[$i]
);
} // end for() } // end for()
// saves the answers into the data base // saves the answers into the data base
$objAnswer->createAnswer('noerror', '', $comment_noerror, '0', $nbrAnswers + 1, null, 'noerror', $destination_noerror); $objAnswer->createAnswer(
'noerror',
'',
$comment_noerror,
'0',
$nbrAnswers + 1,
null,
'noerror',
$destination_noerror
);
$objAnswer->save(); $objAnswer->save();
// sets the total weighting of the question // sets the total weighting of the question
@ -301,7 +323,6 @@ if ($submitAnswers || $buttonBack) {
} }
if ($modifyAnswers) { if ($modifyAnswers) {
if ($debug > 0) { if ($debug > 0) {
echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n"; echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
} }
@ -315,7 +336,6 @@ if ($modifyAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) {
$try = $_POST['try']; $try = $_POST['try'];
for ($i = 1; $i <= $nbrAnswers; $i++) { for ($i = 1; $i <= $nbrAnswers; $i++) {
if ($try[$i] == 'on') { if ($try[$i] == 'on') {
$try[$i] = 1; $try[$i] = 1;
@ -347,7 +367,6 @@ if ($modifyAnswers) {
$destination_items = array(); $destination_items = array();
$destination = array(); $destination = array();
for ($i = 1; $i <= $nbrAnswers; $i++) { for ($i = 1; $i <= $nbrAnswers; $i++) {
$reponse[$i] = $objAnswer->selectAnswer($i); $reponse[$i] = $objAnswer->selectAnswer($i);
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
@ -400,7 +419,7 @@ if ($modifyAnswers) {
$_SESSION['tmp_answers']['destination'] = $destination; $_SESSION['tmp_answers']['destination'] = $destination;
} }
$lessAnswers = isset($lessAnswers) ? $lessAnswers : false; $lessAnswers = isset($_POST['lessAnswers']) ? true : false;
if ($lessAnswers) { if ($lessAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) {
$lest_answer = 1; $lest_answer = 1;
@ -438,7 +457,8 @@ if ($modifyAnswers) {
} }
} }
$moreAnswers = isset($moreAnswers) ? $moreAnswers : false; $moreAnswers = isset($_POST['moreAnswers']) ? true : false;
if ($moreAnswers) { if ($moreAnswers) {
if ($nbrAnswers < 12) { if ($nbrAnswers < 12) {
$nbrAnswers++; $nbrAnswers++;
@ -457,7 +477,9 @@ if ($modifyAnswers) {
} }
} }
$moreOARAnswers = isset($moreOARAnswers) ? $moreOARAnswers : false;
$moreOARAnswers = isset($_POST['moreOARAnswers']) ? true : false;
if ($moreOARAnswers) { if ($moreOARAnswers) {
if ($nbrAnswers < 12) { if ($nbrAnswers < 12) {
// Add a new answer // Add a new answer
@ -481,9 +503,24 @@ if ($modifyAnswers) {
echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n"; echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
} }
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) {
$hotspot_colors = array("", "#4271B5", "#FE8E16", "#45C7F0", "#BCD631", "#D63173", "#D7D7D7", "#90AFDD", "#AF8640", "#4F9242", "#F4EB24", "#ED2024", "#3B3B3B"); $hotspot_colors = array(
"",
"#4271B5",
"#FE8E16",
"#45C7F0",
"#BCD631",
"#D63173",
"#D7D7D7",
"#90AFDD",
"#AF8640",
"#4F9242",
"#F4EB24",
"#ED2024",
"#3B3B3B"
);
} else { } else {
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix) $hotspot_colors = array(
"", // $i starts from 1 on next loop (ugly fix)
"#4271B5", "#4271B5",
"#FE8E16", "#FE8E16",
"#45C7F0", "#45C7F0",
@ -496,7 +533,8 @@ if ($modifyAnswers) {
"#F4EB24", "#F4EB24",
"#ED2024", "#ED2024",
"#3B3B3B", "#3B3B3B",
"#F7BDE2"); "#F7BDE2"
);
} }
Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />'); Display::tag('h3', get_lang('Question') . ": " . $questionName . ' <img src="../img/info3.gif" title="' . strip_tags(get_lang('HotspotChoose')) . '" alt="' . strip_tags(get_lang('HotspotChoose')) . '" />');
@ -504,41 +542,20 @@ if ($modifyAnswers) {
Display::display_normal_message($msgErr); //main API Display::display_normal_message($msgErr); //main API
} }
$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId; $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId.'&'.api_get_cidreq();
?> ?>
<form method="post" action="<?php echo $hotspot_admin_url; ?>" id="frm_exercise" name="frm_exercise"> <form method="post" action="<?php echo $hotspot_admin_url; ?>" id="frm_exercise" name="frm_exercise">
<table border="0" cellpadding="0" cellspacing="2" width="100%"> <table border="0" cellpadding="0" cellspacing="2" width="100%">
<tr> <tr>
<td colspan="2" valign="bottom"> <td colspan="2" valign="bottom">
<?php
$navigator_info = api_get_navigator();
//ie6 fix
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
?>
<?php if ($answerType == HOT_SPOT_DELINEATION) { ?> <?php if ($answerType == HOT_SPOT_DELINEATION) { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessOAR'); ?>" > <button type="submit" class="btn minus" name="lessAnswers" value="lessAnswers" ><?php echo get_lang('LessOAR'); ?></button>
<input type="submit" class="btn plus" name="moreOARAnswers" value="<?php echo get_lang('MoreOAR'); ?>" /> <button type="submit" class="btn plus" name="moreOARAnswers" value="moreOARAnswers" /><?php echo get_lang('MoreOAR'); ?></button>
<?php } else { ?> <?php } else { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessHotspots'); ?>" > <button type="submit" class="btn minus" name="lessAnswers" value="lessAnswers" ><?php echo get_lang('LessHotspots'); ?></button>
<input type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" /> <button type="submit" class="btn plus" name="moreAnswers" value="moreAnswers" /><?php echo get_lang('MoreHotspots'); ?></button>
<?php } ?> <?php } ?>
<input type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" /> <button type="submit" class="btn save" name="submitAnswers" value="submitAnswers" /><?php echo get_lang('AddQuestionToExercise'); ?></button>
<?php
} else {
if ($answerType == HOT_SPOT_DELINEATION) {
?>
<button type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessOAR'); ?>" ><?php echo get_lang('LessOAR'); ?></button>
<button type="submit" class="btn plus" name="moreOARAnswers" value="<?php echo get_lang('MoreOAR'); ?>" /><?php echo get_lang('MoreOAR'); ?></button>
<?php } else { ?>
<button type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessHotspots'); ?>" ><?php echo get_lang('LessHotspots'); ?></button>
<button type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" /><?php echo get_lang('MoreHotspots'); ?></button>
<?php } ?>
<button type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" /><?php echo get_lang('AddQuestionToExercise'); ?></button>
<?php
}
?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -546,34 +563,30 @@ if ($modifyAnswers) {
<input type="hidden" name="formSent" value="1" /> <input type="hidden" name="formSent" value="1" />
<input type="hidden" name="nbrAnswers" value="<?php echo $nbrAnswers; ?>" /> <input type="hidden" name="nbrAnswers" value="<?php echo $nbrAnswers; ?>" />
<table class="data_table"> <table class="data_table">
<!--
<tr> <tr>
<td colspan="5"><?php echo get_lang('AnswerHotspot'); ?> :</td> <th width="5">&nbsp;</th>
</tr> <th> <?php echo get_lang('HotspotDescription'); ?> *</th>
--> <?php if ($answerType == HOT_SPOT_DELINEATION)
<tr> echo '<th >' . get_lang('Thresholds') . '</th>'; ?>
<th width="5">&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<th><?php echo get_lang('HotspotDescription'); ?> *</th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Thresholds') . '</th>'; ?>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<th><?php echo get_lang('Comment'); ?></th> <th><?php echo get_lang('Comment'); ?></th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Scenario') . '</th>'; ?>
<?php if ($answerType == HOT_SPOT_DELINEATION)
echo '<th >' . get_lang('Scenario') . '</th>'; ?>
<?php } else { ?> <?php } else { ?>
<th colspan="2"><?php echo get_lang('Comment'); ?></th> <th colspan="2"><?php echo get_lang('Comment'); ?></th>
<?php } ?> <?php } ?>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th> <th><?php echo get_lang('QuestionWeighting'); ?> *</th>
</tr> </tr>
<?php <?php
$list = new LearnpathList(api_get_user_id()); $list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list(); //loading list of LPs // Loading list of LPs
$flat_list = $list->get_flat_list();
for ($i = 1; $i <= $nbrAnswers; $i++) { for ($i = 1; $i <= $nbrAnswers; $i++) {
// is an delineation // is an delineation
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) {
$select_lp_id = array(); $select_lp_id = array();
$option_lp = ''; $option_lp = '';
@ -594,7 +607,7 @@ if ($modifyAnswers) {
$option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
} }
//Feedback SELECT // Feedback SELECT
$question_list = $objExercise->selectQuestionList(); $question_list = $objExercise->selectQuestionList();
$option_feed = ''; $option_feed = '';
$option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
@ -609,10 +622,11 @@ if ($modifyAnswers) {
} }
$option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>'; $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
} }
if ($select_question[$i] == -1) if ($select_question[$i] == -1) {
$option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>'; $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
else } else {
$option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>'; $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
}
//-------- IF it is a delineation //-------- IF it is a delineation
@ -656,7 +670,6 @@ if ($modifyAnswers) {
</select>% </select>%
<br/> <br/>
</td> </td>
<td align="left"> <td align="left">
<br /> <br />
<textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"> <textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%">
@ -667,7 +680,6 @@ if ($modifyAnswers) {
<br/> <br/>
<?php echo get_lang('LearnerIsInformed'); ?> <?php echo get_lang('LearnerIsInformed'); ?>
</td> </td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td> <td>
<table> <table>
@ -676,13 +688,10 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?> <?php echo get_lang('TryAgain'); ?>
<br /><br /> <br /><br />
<?php echo get_lang('SeeTheory'); ?> <br /> <?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" > <select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?> <?php echo $option_lp; ?>
</select> </select>
<br /><br /> <br /><br />
<?php echo get_lang('Other'); ?> <br /> <?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>"> <input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
@ -691,10 +700,7 @@ if ($modifyAnswers) {
<select name="select_question[<?php echo $i; ?>]" > <select name="select_question[<?php echo $i; ?>]" >
<?php echo $option_feed; ?> <?php echo $option_feed; ?>
</select> </select>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
@ -702,9 +708,7 @@ if ($modifyAnswers) {
<td> &nbsp;</td> <td> &nbsp;</td>
<?php <?php
} }
} } elseif (false) {
//elseif ($_SESSION['tmp_answers']['hotspot_type'][$i]=='noerror' || $_SESSION['tmp_answers']['answer'][$i]=='noerror')
elseif (false) {
?> ?>
<tr> <tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th> <th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
@ -723,7 +727,6 @@ if ($modifyAnswers) {
<td colspan="2" align="left"> <td colspan="2" align="left">
<textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo Security::remove_XSS($comment[$i]); ?></textarea> <textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo Security::remove_XSS($comment[$i]); ?></textarea>
</td> </td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td> <td>
<table> <table>
@ -732,13 +735,12 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?> <?php echo get_lang('TryAgain'); ?>
<br /><br /> <br /><br />
<?php echo get_lang('SeeTheory'); ?>
<?php echo get_lang('SeeTheory'); ?> <br /> <br />
<select name="lp[<?php echo $i; ?>]" > <select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?> <?php echo $option_lp; ?>
</select> </select>
<br /><br /> <br /><br />
<?php echo get_lang('Other'); ?> <br /> <?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>"> <input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
<br /> <br /> <br /> <br />
@ -753,12 +755,10 @@ if ($modifyAnswers) {
<?php } else { ?> <?php } else { ?>
<td>&nbsp;</td> <td>&nbsp;</td>
<?php } ?> <?php } ?>
</tr> </tr>
<?php <?php
} } elseif ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') {
// if it's an OAR // if it's an OAR
elseif ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') {
if ($i == 2) { if ($i == 2) {
?> ?>
<tr> <tr>
@ -770,17 +770,13 @@ if ($modifyAnswers) {
<?php } else { ?> <?php } else { ?>
<th colspan="3" ><?php echo get_lang('Comment'); ?></th> <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
<?php } ?> <?php } ?>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
<?php <?php } ?>
}
?>
<tr> <tr>
<td valign="top"> <td valign="top">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div> <div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
</td> </td>
<td valign="top" align="left"> <td valign="top" align="left">
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="20" /> <input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="20" />
</td> </td>
@ -790,7 +786,6 @@ if ($modifyAnswers) {
<input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="oar" /> <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="oar" />
<input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" /> <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
</td> </td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td> <td>
<table> <table>
@ -799,7 +794,6 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?> <?php echo get_lang('TryAgain'); ?>
<br /><br /> <br /><br />
<?php echo get_lang('SeeTheory'); ?> <br /> <?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" > <select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?> <?php echo $option_lp; ?>
@ -812,68 +806,66 @@ if ($modifyAnswers) {
<select name="select_question[<?php echo $i; ?>]"> <select name="select_question[<?php echo $i; ?>]">
<?php echo $option_feed; ?> <?php echo $option_feed; ?>
</select> </select>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
<?php } else { ?> <?php } else { ?>
<td>&nbsp;</td> <td>&nbsp;</td>
<?php } ?> <?php }
<?php
} }
} else { //end if is delineation //end if is delineation
} else {
$commentValue = isset($comment[$i]) ? $comment[$i] : null;
$responseValue = isset($reponse[$i]) ? $reponse[$i] : null;
?> ?>
<td valign="top"> <td valign="top">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div> <div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
</td> </td>
<td valign="top" align="left"> <td valign="top" align="left">
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="45" /> <input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" size="45" />
</td> </td>
<?php <?php
// @todo use formvalidator $form = new FormValidator('form_'.$i);
/*$oFCKeditor = new CKeditor(); $config = array(
$content = $comment[$i]; 'ToolbarSet' => 'TestProposedAnswer'
$oFCKeditor->ToolbarSet = 'TestProposedAnswer'; );
$oFCKeditor->Config['ToolbarStartExpanded'] = 'false'; $form->add_html_editor('comment['.$i.']', null, false, false, $config);
$oFCKeditor->Width = '100%'; $renderer = $form->defaultRenderer();
$oFCKeditor->Height = '100'; $form_template = '{content}';
$oFCKeditor->Value = $content; $renderer->setFormTemplate($form_template);
//$return = $oFCKeditor->CreateHtml(); $element_template = '
$return = $oFCKeditor->editor("comment[$i]", $oFCKeditor->Value);*/ {label}
/* <td align="left"><textarea wrap="virtual" rows="1" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo api_htmlentities($comment[$i], ENT_QUOTES, api_get_system_encoding()); ?></textarea></td> */ {element}
';
$renderer->setElementTemplate($element_template);
$form->setDefaults(array('comment['.$i.']' => $commentValue));
$return = $form->return_form();
?> ?>
<td>&nbsp;</td> <td>&nbsp;</td>
<td align="left" ><?php echo $return; ?></td> <td align="left" ><?php echo $return; ?></td>
<?php <?php } ?>
}
?>
<td valign="top"> <td valign="top">
<?php <?php
//if ($answerType==HOT_SPOT_DELINEATION && $i!=2)
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) {
if ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') { if ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') { ?>
?>
<input type="hidden" name="weighting[<?php echo $i; ?>]" class="span3" value="0" /> <input type="hidden" name="weighting[<?php echo $i; ?>]" class="span3" value="0" />
<?php } else { ?> <?php } else { ?>
<input type="text" name="weighting[<?php echo $i; ?>]" class="span3" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> <input type="text" name="weighting[<?php echo $i; ?>]" class="span3" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
<?php <?php
} }
} }
if ($answerType == HOT_SPOT) { if ($answerType == HOT_SPOT) { ?>
?>
<input type="text" name="weighting[<?php echo $i; ?>]" class="span3" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> <input type="text" name="weighting[<?php echo $i; ?>]" class="span3" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
<input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" /> <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
<input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" /> <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" />
<?php <?php } ?>
}
?>
</td> </td>
</tr> </tr>
<?php <?php
} }
$list = new LearnpathList(api_get_user_id()); $list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list(); $flat_list = $list->get_flat_list();
$select_lp_id = array(); $select_lp_id = array();
@ -882,7 +874,7 @@ if ($modifyAnswers) {
foreach ($flat_list as $id => $details) { foreach ($flat_list as $id => $details) {
$selected = ''; $selected = '';
$select_lp_id[$id] = $details['lp_name']; $select_lp_id[$id] = $details['lp_name'];
if ($id == $lp_noerror) { if (isset($lp_noerror) && $id == $lp_noerror) {
$selected = 'selected="selected"'; $selected = 'selected="selected"';
$isSelected = true; $isSelected = true;
} }
@ -895,8 +887,7 @@ if ($modifyAnswers) {
$option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp; $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
} }
//Feedback SELECT // Feedback SELECT
$question_list = $objExercise->selectQuestionList(); $question_list = $objExercise->selectQuestionList();
$option_feed = ''; $option_feed = '';
$option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>'; $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
@ -918,8 +909,7 @@ if ($modifyAnswers) {
else else
$option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>'; $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
if ($answerType == HOT_SPOT_DELINEATION) { if ($answerType == HOT_SPOT_DELINEATION) { ?>
?>
<tr> <tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th> <th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
@ -937,7 +927,6 @@ if ($modifyAnswers) {
<td colspan="2" align="left"> <td colspan="2" align="left">
<textarea wrap="virtual" rows="3" cols="25" name="comment_noerror" style="width: 100%"><?php echo Security::remove_XSS($comment_noerror); ?></textarea> <textarea wrap="virtual" rows="3" cols="25" name="comment_noerror" style="width: 100%"><?php echo Security::remove_XSS($comment_noerror); ?></textarea>
</td> </td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td> <td>
<table> <table>
@ -951,7 +940,6 @@ if ($modifyAnswers) {
<?php echo $option_lp; ?> <?php echo $option_lp; ?>
</select> </select>
<br /><br /> <br /><br />
<?php echo get_lang('Other'); ?> <br /> <?php echo get_lang('Other'); ?> <br />
<input name="url_noerror" value="<?php echo $url_noerror; ?>"> <input name="url_noerror" value="<?php echo $url_noerror; ?>">
<br /><br /> <br /><br />
@ -968,9 +956,7 @@ if ($modifyAnswers) {
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
<?php } ?> <?php } ?>
</tr> </tr>
<?php <?php } ?>
}
?>
</table> </table>
</td> </td>
</tr> </tr>
@ -1000,7 +986,6 @@ if ($modifyAnswers) {
// --> // -->
</script> </script>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>

@ -8,7 +8,7 @@
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $ * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/ */
include('../inc/global.inc.php'); require_once '../inc/global.inc.php';
$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
$questionId = intval($_GET['questionId']); $questionId = intval($_GET['questionId']);

@ -7,7 +7,7 @@
* @author Toon Keppens * @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $ * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/ */
include('../inc/global.inc.php'); require_once '../inc/global.inc.php';
$courseCode = $_GET['coursecode']; $courseCode = $_GET['coursecode'];
$questionId = $_GET['questionId']; $questionId = $_GET['questionId'];
$coordinates = $_GET['coord']; $coordinates = $_GET['coord'];
@ -36,7 +36,7 @@ foreach ($coords as $coord) {
} }
$coordinates = substr($coordinates,0,-1); $coordinates = substr($coordinates,0,-1);
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS); $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Save into db // Save into db
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (user_id , course_id , quiz_id , question_id , answer_id , correct , coordinate ) VALUES ( $sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (user_id , course_id , quiz_id , question_id , answer_id , correct , coordinate ) VALUES (
".intval($_user['user_id']).", ".intval($_user['user_id']).",

@ -8,7 +8,7 @@
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $ * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/ */
include '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$courseCode = $_GET['coursecode']; $courseCode = $_GET['coursecode'];
$questionId = $_GET['questionId']; $questionId = $_GET['questionId'];
@ -47,7 +47,7 @@ foreach ($coords as $coord) {
} }
$coordinates = substr($coordinates,0,-1); $coordinates = substr($coordinates,0,-1);
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS); $TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// update db // update db
$update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId]; $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];

Loading…
Cancel
Save