Ckeditor - hotspot fixes.

1.10.x
Julio Montoya 10 years ago
parent 5d351996b3
commit 662238a892
  1. 11
      main/exercice/admin.php
  2. 265
      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;
$modifyIn = isset($modifyIn) ? $modifyIn : null;
$cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null;
$_course = api_get_course_info();
/* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems
when changing the exercise settings, number of questions, etc */
@ -186,8 +187,6 @@ if (!is_object($objExercise)) {
// Exercise can be edited in their course.
if ($objExercise->sessionId != $sessionId) {
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
@ -275,6 +274,7 @@ if ($cancelAnswers) {
$editQuestion=$modifyAnswers;
unset($modifyAnswers);
}
$nameTools = null;
// modifies the query string that is used in the link of tool name
if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
@ -292,9 +292,9 @@ 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']) ) {
$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 {
$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
}
@ -332,8 +332,6 @@ function multiple_answer_true_false_onchange(variable) {
}
document.getElementById(weight_id).value = array_result[result];
}
</script>';
$htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/JavaScriptFlashGateway.js\"></script>
@ -523,7 +521,6 @@ if ($newQuestion || $editQuestion) {
if ($newQuestion == 'yes') {
$objExercise->edit_exercise_in_lp = true;
}
require 'question_admin.inc.php';
}

@ -1,14 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows to manage answers. It is included from the
* script admin.php
* @package chamilo.exercise
* @author Toon Keppens
*/
/**
* Init
*/
use \ChamiloSession as Session;
$modifyAnswers = intval($_GET['hotspotadmin']);
@ -21,15 +20,15 @@ $questionName = $objQuestion->selectTitle();
$answerType = $objQuestion->selectType();
$pictureName = $objQuestion->selectPicture();
$debug = 0; // debug variable to get where we are
$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 ($debug > 0) {
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') {
// duplicates the question
$questionId = $objQuestion->duplicate();
@ -53,7 +52,6 @@ if ($modifyIn) {
$objAnswer->duplicate($questionId);
// construction of the duplicated Answers
$objAnswer = new Answer($questionId);
}
$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;
// 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 ($answerType == HOT_SPOT) {
if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set' . "<br />\n";
}
$questionWeighting = $nbrGoodAnswers = 0;
for ($i = 1; $i <= $nbrAnswers; $i++) {
if ($debug > 0) {
@ -88,6 +85,7 @@ if ($submitAnswers || $buttonBack) {
$reponse[$i] = trim($reponse[$i]);
$comment[$i] = trim($comment[$i]);
$weighting[$i] = $weighting[$i]; // it can be float
// checks if field is empty
if (empty($reponse[$i]) && $reponse[$i] != '0') {
$msgErr = get_lang('HotspotGiveAnswers');
@ -124,7 +122,15 @@ if ($submitAnswers || $buttonBack) {
$questionWeighting+=$weighting[$i];
}
// 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()
// saves the answers into the data base
$objAnswer->save();
@ -141,7 +147,6 @@ if ($submitAnswers || $buttonBack) {
echo '$modifyIn was set - end' . "<br />\n";
}
} else {
if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set' . "<br />\n";
}
@ -164,23 +169,25 @@ if ($submitAnswers || $buttonBack) {
$comment[$i] = trim($comment[$i]);
$weighting[$i] = $weighting[$i];
if (empty($threadhold1[$i]))
if (empty($threadhold1[$i])) {
$threadhold1_str = 0;
else
} else {
$threadhold1_str = intval($threadhold1[$i]);
}
if (empty($threadhold2[$i]))
if (empty($threadhold2[$i])) {
$threadhold2_str = 0;
else
} else {
$threadhold2_str = intval($threadhold2[$i]);
}
if (empty($threadhold3[$i]))
if (empty($threadhold3[$i])) {
$threadhold3_str = 0;
else
} else {
$threadhold3_str = intval($threadhold3[$i]);
}
$threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
//echo '<pre>';print_r($_POST);echo '</pre>';
if ($try[$i] == 'on') {
$try_str = 1;
@ -207,9 +214,6 @@ if ($submitAnswers || $buttonBack) {
}
$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
if (empty($reponse[$i]) && $reponse[$i] != '0') {
$msgErr = get_lang('HotspotGiveAnswers');
@ -281,11 +285,29 @@ if ($submitAnswers || $buttonBack) {
$questionWeighting+=$weighting[$i];
}
// 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()
// 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();
// sets the total weighting of the question
@ -301,7 +323,6 @@ if ($submitAnswers || $buttonBack) {
}
if ($modifyAnswers) {
if ($debug > 0) {
echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
}
@ -315,7 +336,6 @@ if ($modifyAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) {
$try = $_POST['try'];
for ($i = 1; $i <= $nbrAnswers; $i++) {
if ($try[$i] == 'on') {
$try[$i] = 1;
@ -347,7 +367,6 @@ if ($modifyAnswers) {
$destination_items = array();
$destination = array();
for ($i = 1; $i <= $nbrAnswers; $i++) {
$reponse[$i] = $objAnswer->selectAnswer($i);
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
@ -400,7 +419,7 @@ if ($modifyAnswers) {
$_SESSION['tmp_answers']['destination'] = $destination;
}
$lessAnswers = isset($lessAnswers) ? $lessAnswers : false;
$lessAnswers = isset($_POST['lessAnswers']) ? true : false;
if ($lessAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) {
$lest_answer = 1;
@ -438,7 +457,8 @@ if ($modifyAnswers) {
}
}
$moreAnswers = isset($moreAnswers) ? $moreAnswers : false;
$moreAnswers = isset($_POST['moreAnswers']) ? true : false;
if ($moreAnswers) {
if ($nbrAnswers < 12) {
$nbrAnswers++;
@ -457,7 +477,9 @@ if ($modifyAnswers) {
}
}
$moreOARAnswers = isset($moreOARAnswers) ? $moreOARAnswers : false;
$moreOARAnswers = isset($_POST['moreOARAnswers']) ? true : false;
if ($moreOARAnswers) {
if ($nbrAnswers < 12) {
// Add a new answer
@ -481,9 +503,24 @@ if ($modifyAnswers) {
echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
}
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 {
$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",
"#FE8E16",
"#45C7F0",
@ -496,7 +533,8 @@ if ($modifyAnswers) {
"#F4EB24",
"#ED2024",
"#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')) . '" />');
@ -504,41 +542,20 @@ if ($modifyAnswers) {
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">
<table border="0" cellpadding="0" cellspacing="2" width="100%">
<tr>
<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) { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessOAR'); ?>" >
<input type="submit" class="btn plus" name="moreOARAnswers" value="<?php echo get_lang('MoreOAR'); ?>" />
<button type="submit" class="btn minus" name="lessAnswers" value="lessAnswers" ><?php echo get_lang('LessOAR'); ?></button>
<button type="submit" class="btn plus" name="moreOARAnswers" value="moreOARAnswers" /><?php echo get_lang('MoreOAR'); ?></button>
<?php } else { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessHotspots'); ?>" >
<input type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" />
<button type="submit" class="btn minus" name="lessAnswers" value="lessAnswers" ><?php echo get_lang('LessHotspots'); ?></button>
<button type="submit" class="btn plus" name="moreAnswers" value="moreAnswers" /><?php echo get_lang('MoreHotspots'); ?></button>
<?php } ?>
<input type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" />
<?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
}
?>
<button type="submit" class="btn save" name="submitAnswers" value="submitAnswers" /><?php echo get_lang('AddQuestionToExercise'); ?></button>
</td>
</tr>
<tr>
@ -546,34 +563,30 @@ if ($modifyAnswers) {
<input type="hidden" name="formSent" value="1" />
<input type="hidden" name="nbrAnswers" value="<?php echo $nbrAnswers; ?>" />
<table class="data_table">
<!--
<tr>
<td colspan="5"><?php echo get_lang('AnswerHotspot'); ?> :</td>
</tr>
-->
<tr>
<th width="5">&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<th width="5">&nbsp;</th>
<th> <?php echo get_lang('HotspotDescription'); ?> *</th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Thresholds') . '</th>'; ?>
<?php if ($answerType == HOT_SPOT_DELINEATION)
echo '<th >' . get_lang('Thresholds') . '</th>'; ?>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<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 { ?>
<th colspan="2"><?php echo get_lang('Comment'); ?></th>
<?php } ?>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th>
</tr>
<?php
$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++) {
// is an delineation
if ($answerType == HOT_SPOT_DELINEATION) {
$select_lp_id = array();
$option_lp = '';
@ -609,10 +622,11 @@ if ($modifyAnswers) {
}
$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>';
else
} else {
$option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
}
//-------- IF it is a delineation
@ -656,7 +670,6 @@ if ($modifyAnswers) {
</select>%
<br/>
</td>
<td align="left">
<br />
<textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%">
@ -667,7 +680,6 @@ if ($modifyAnswers) {
<br/>
<?php echo get_lang('LearnerIsInformed'); ?>
</td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td>
<table>
@ -676,13 +688,10 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
@ -691,10 +700,7 @@ if ($modifyAnswers) {
<select name="select_question[<?php echo $i; ?>]" >
<?php echo $option_feed; ?>
</select>
</td>
</tr>
</table>
</td>
@ -702,9 +708,7 @@ if ($modifyAnswers) {
<td> &nbsp;</td>
<?php
}
}
//elseif ($_SESSION['tmp_answers']['hotspot_type'][$i]=='noerror' || $_SESSION['tmp_answers']['answer'][$i]=='noerror')
elseif (false) {
} elseif (false) {
?>
<tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
@ -723,7 +727,6 @@ if ($modifyAnswers) {
<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>
</td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td>
<table>
@ -732,13 +735,12 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<?php echo get_lang('SeeTheory'); ?>
<br />
<select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
<br /> <br />
@ -753,12 +755,10 @@ if ($modifyAnswers) {
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
} elseif ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') {
// if it's an OAR
elseif ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') {
if ($i == 2) {
?>
<tr>
@ -770,17 +770,13 @@ if ($modifyAnswers) {
<?php } else { ?>
<th colspan="3" ><?php echo get_lang('Comment'); ?></th>
<?php } ?>
<th>&nbsp;</th>
</tr>
<?php
}
?>
<?php } ?>
<tr>
<td valign="top">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
</td>
<td valign="top" align="left">
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="20" />
</td>
@ -790,7 +786,6 @@ if ($modifyAnswers) {
<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]); ?>" />
</td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td>
<table>
@ -799,7 +794,6 @@ if ($modifyAnswers) {
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?>
@ -812,68 +806,66 @@ if ($modifyAnswers) {
<select name="select_question[<?php echo $i; ?>]">
<?php echo $option_feed; ?>
</select>
</td>
</tr>
</table>
</td>
<?php } else { ?>
<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">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
</td>
<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>
<?php
// @todo use formvalidator
/*$oFCKeditor = new CKeditor();
$content = $comment[$i];
$oFCKeditor->ToolbarSet = 'TestProposedAnswer';
$oFCKeditor->Config['ToolbarStartExpanded'] = 'false';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '100';
$oFCKeditor->Value = $content;
//$return = $oFCKeditor->CreateHtml();
$return = $oFCKeditor->editor("comment[$i]", $oFCKeditor->Value);*/
/* <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> */
$form = new FormValidator('form_'.$i);
$config = array(
'ToolbarSet' => 'TestProposedAnswer'
);
$form->add_html_editor('comment['.$i.']', null, false, false, $config);
$renderer = $form->defaultRenderer();
$form_template = '{content}';
$renderer->setFormTemplate($form_template);
$element_template = '
{label}
{element}
';
$renderer->setElementTemplate($element_template);
$form->setDefaults(array('comment['.$i.']' => $commentValue));
$return = $form->return_form();
?>
<td>&nbsp;</td>
<td align="left" ><?php echo $return; ?></td>
<?php
}
?>
<?php } ?>
<td valign="top">
<?php
//if ($answerType==HOT_SPOT_DELINEATION && $i!=2)
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" />
<?php } else { ?>
<input type="text" name="weighting[<?php echo $i; ?>]" class="span3" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
<?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="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]); ?>" />
<?php
}
?>
<?php } ?>
</td>
</tr>
<?php
}
$list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list();
$select_lp_id = array();
@ -882,7 +874,7 @@ if ($modifyAnswers) {
foreach ($flat_list as $id => $details) {
$selected = '';
$select_lp_id[$id] = $details['lp_name'];
if ($id == $lp_noerror) {
if (isset($lp_noerror) && $id == $lp_noerror) {
$selected = 'selected="selected"';
$isSelected = true;
}
@ -896,7 +888,6 @@ if ($modifyAnswers) {
}
// Feedback SELECT
$question_list = $objExercise->selectQuestionList();
$option_feed = '';
$option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
@ -918,8 +909,7 @@ if ($modifyAnswers) {
else
$option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
if ($answerType == HOT_SPOT_DELINEATION) {
?>
if ($answerType == HOT_SPOT_DELINEATION) { ?>
<tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
@ -937,7 +927,6 @@ if ($modifyAnswers) {
<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>
</td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td>
<table>
@ -951,7 +940,6 @@ if ($modifyAnswers) {
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<input name="url_noerror" value="<?php echo $url_noerror; ?>">
<br /><br />
@ -968,9 +956,7 @@ if ($modifyAnswers) {
<td colspan="2">&nbsp;</td>
<?php } ?>
</tr>
<?php
}
?>
<?php } ?>
</table>
</td>
</tr>
@ -1000,7 +986,6 @@ if ($modifyAnswers) {
// -->
</script>
</td>
</tr>
</table>
</form>

@ -8,7 +8,7 @@
* @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);
$questionId = intval($_GET['questionId']);

@ -7,7 +7,7 @@
* @author Toon Keppens
* @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'];
$questionId = $_GET['questionId'];
$coordinates = $_GET['coord'];
@ -36,7 +36,7 @@ foreach ($coords as $coord) {
}
$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
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (user_id , course_id , quiz_id , question_id , answer_id , correct , coordinate ) VALUES (
".intval($_user['user_id']).",

@ -8,7 +8,7 @@
* @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'];
$questionId = $_GET['questionId'];
@ -47,7 +47,7 @@ foreach ($coords as $coord) {
}
$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_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];

Loading…
Cancel
Save