|
|
|
@ -4,9 +4,9 @@ |
|
|
|
|
use ChamiloSession as Session; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author Julio Montoya <gugli100@gmail.com> |
|
|
|
|
*/ |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author Julio Montoya <gugli100@gmail.com> |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
|
api_protect_course_script(false); |
|
|
|
@ -79,40 +79,40 @@ if (isset($_GET['choice'])) { |
|
|
|
|
// Getting the options by js |
|
|
|
|
if (empty($choice_value)) { |
|
|
|
|
echo "<script> |
|
|
|
|
// this works for only radio buttons |
|
|
|
|
var f = self.parent.window.document.frm_exercise; |
|
|
|
|
var choice_js=''; |
|
|
|
|
|
|
|
|
|
var hotspot = new Array(); |
|
|
|
|
var hotspotcoord = new Array(); |
|
|
|
|
var counter=0; |
|
|
|
|
for ( var i = 0; i < f.elements.length; i++ ) { |
|
|
|
|
if (f.elements[i].type=='radio' && f.elements[i].checked) { |
|
|
|
|
choice_js = f.elements[i].value; |
|
|
|
|
// this works for only radio buttons |
|
|
|
|
var f = self.parent.window.document.frm_exercise; |
|
|
|
|
var choice_js=''; |
|
|
|
|
|
|
|
|
|
var hotspot = new Array(); |
|
|
|
|
var hotspotcoord = new Array(); |
|
|
|
|
var counter=0; |
|
|
|
|
for ( var i = 0; i < f.elements.length; i++ ) { |
|
|
|
|
if (f.elements[i].type=='radio' && f.elements[i].checked) { |
|
|
|
|
choice_js = f.elements[i].value; |
|
|
|
|
counter ++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (f.elements[i].type=='hidden' ) { |
|
|
|
|
name = f.elements[i].name; |
|
|
|
|
if (name.substr(0,7)=='hotspot') |
|
|
|
|
hotspot.push(f.elements[i].value); |
|
|
|
|
|
|
|
|
|
if (name.substr(0,20)=='hotspot_coordinates') |
|
|
|
|
hotspotcoord.push(f.elements[i].value); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (counter==0) { |
|
|
|
|
choice_js=-1; // this is an error |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
"; |
|
|
|
|
// IMPORTANT |
|
|
|
|
//this is the real redirect function |
|
|
|
|
//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (f.elements[i].type=='hidden' ) { |
|
|
|
|
name = f.elements[i].name; |
|
|
|
|
if (name.substr(0,7)=='hotspot') |
|
|
|
|
hotspot.push(f.elements[i].value); |
|
|
|
|
|
|
|
|
|
if (name.substr(0,20)=='hotspot_coordinates') |
|
|
|
|
hotspotcoord.push(f.elements[i].value); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (counter==0) { |
|
|
|
|
choice_js=-1; // this is an error |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
"; |
|
|
|
|
// IMPORTANT |
|
|
|
|
//this is the real redirect function |
|
|
|
|
//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
|
|
|
echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
|
|
|
echo "$('#global-modal .modal-body').load(url);"; |
|
|
|
|
echo '</script>'; |
|
|
|
|
echo '</script>'; |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -152,9 +152,9 @@ Session::write('exerciseResultCoordinates', $exerciseResultCoordinates); |
|
|
|
|
if($questionNum >= $nbrQuestions) |
|
|
|
|
{ |
|
|
|
|
if($debug>0){echo str_repeat(' ',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 |
|
|
|
|
// goes to the script that will show the result of the exercise |
|
|
|
|
// header("Location: exercise_result.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); |
|
|
|
|
// echo 'location result'; |
|
|
|
|
// echo 'location result'; |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
// creates a temporary Question object |
|
|
|
@ -431,29 +431,29 @@ if (!empty($choice_value)) { |
|
|
|
|
$final_excess = 100; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$table_resume = '<table class="data_table"> |
|
|
|
|
<tr class="row_odd"> |
|
|
|
|
<td></td> |
|
|
|
|
<td ><b>'.get_lang('Requirements').'</b></td> |
|
|
|
|
<td><b>'.get_lang('YourAnswer').'</b></td> |
|
|
|
|
</tr> |
|
|
|
|
<tr class="row_even"> |
|
|
|
|
<td><b>'.get_lang('Overlap').'</b></td> |
|
|
|
|
<td>'.get_lang('Min').' '.$threadhold1.'</td> |
|
|
|
|
<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td><b>'.get_lang('Excess').'</b></td> |
|
|
|
|
<td>'.get_lang('Max').' '.$threadhold2.'</td> |
|
|
|
|
<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr class="row_even"> |
|
|
|
|
<td><b>'.get_lang('Missing').'</b></td> |
|
|
|
|
<td>'.get_lang('Max').' '.$threadhold3.'</td> |
|
|
|
|
<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
</table>'; |
|
|
|
|
$table_resume = '<table class="data_table"> |
|
|
|
|
<tr class="row_odd"> |
|
|
|
|
<td></td> |
|
|
|
|
<td ><b>'.get_lang('Requirements').'</b></td> |
|
|
|
|
<td><b>'.get_lang('YourAnswer').'</b></td> |
|
|
|
|
</tr> |
|
|
|
|
<tr class="row_even"> |
|
|
|
|
<td><b>'.get_lang('Overlap').'</b></td> |
|
|
|
|
<td>'.get_lang('Min').' '.$threadhold1.'</td> |
|
|
|
|
<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td><b>'.get_lang('Excess').'</b></td> |
|
|
|
|
<td>'.get_lang('Max').' '.$threadhold2.'</td> |
|
|
|
|
<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr class="row_even"> |
|
|
|
|
<td><b>'.get_lang('Missing').'</b></td> |
|
|
|
|
<td>'.get_lang('Max').' '.$threadhold3.'</td> |
|
|
|
|
<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
|
|
|
</tr> |
|
|
|
|
</table>'; |
|
|
|
|
} |
|
|
|
|
Session::write('newquestionList', $newquestionList); |
|
|
|
|
$links = ''; |
|
|
|
@ -510,45 +510,45 @@ if (isset($try) && $try == 1) { |
|
|
|
|
|
|
|
|
|
// the link to theory (a learning path) |
|
|
|
|
if (!empty($lp)) { |
|
|
|
|
$lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
|
|
|
$list = new LearnpathList(api_get_user_id()); |
|
|
|
|
$flat_list = $list->get_flat_list(); |
|
|
|
|
$lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
|
|
|
$list = new LearnpathList(api_get_user_id()); |
|
|
|
|
$flat_list = $list->get_flat_list(); |
|
|
|
|
$links .= Display:: return_icon( |
|
|
|
|
'theory.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
|
|
|
'theory.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
|
|
|
} |
|
|
|
|
$links .= '<br />'; |
|
|
|
|
|
|
|
|
|
// the link to an external website or link |
|
|
|
|
if (!empty($url)) { |
|
|
|
|
$links .= Display:: return_icon( |
|
|
|
|
'link.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'padding-left:0px;padding-right:5px;') |
|
|
|
|
'link.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// the link to finish the test |
|
|
|
|
if ($destinationid == -1) { |
|
|
|
|
$links .= Display:: return_icon( |
|
|
|
|
'finish.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
|
|
|
'finish.gif', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
|
|
|
} else { |
|
|
|
|
// the link to other question |
|
|
|
|
if (in_array($destinationid, $questionList)) { |
|
|
|
|
$objQuestionTmp = Question :: read($destinationid); |
|
|
|
|
$questionName = $objQuestionTmp->selectTitle(); |
|
|
|
|
$num_value_array = (array_keys($questionList, $destinationid)); |
|
|
|
|
// the link to other question |
|
|
|
|
if (in_array($destinationid, $questionList)) { |
|
|
|
|
$objQuestionTmp = Question :: read($destinationid); |
|
|
|
|
$questionName = $objQuestionTmp->selectTitle(); |
|
|
|
|
$num_value_array = (array_keys($questionList, $destinationid)); |
|
|
|
|
$links .= Display:: return_icon( |
|
|
|
|
'quiz.png', |
|
|
|
|
'', |
|
|
|
|
array('style' => 'padding-left:0px;padding-right:5px;') |
|
|
|
|
).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
@ -565,30 +565,30 @@ function SendEx(num) { |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
if ($links != '') { |
|
|
|
|
echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
|
|
|
if ($answerType == HOT_SPOT_DELINEATION) { |
|
|
|
|
if ($organs_at_risk_hit > 0) { |
|
|
|
|
//$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
|
|
|
//$message.=$table_resume; |
|
|
|
|
$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
|
|
|
//if ($wrong_results) { } |
|
|
|
|
$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
|
|
|
$message .= '<p>'.$comment.'</p>'; |
|
|
|
|
} else { |
|
|
|
|
$message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
|
|
|
$message .= $table_resume; |
|
|
|
|
$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
|
|
|
$message .= '<p>'.$comment.'</p>'; |
|
|
|
|
} |
|
|
|
|
echo $message; |
|
|
|
|
} else { |
|
|
|
|
echo '<p>'.$comment.'</p>'; |
|
|
|
|
} |
|
|
|
|
echo '<h3>'.$links.'</h3>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
Session::write('hot_spot_result', $message); |
|
|
|
|
$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
|
|
|
echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
|
|
|
if ($answerType == HOT_SPOT_DELINEATION) { |
|
|
|
|
if ($organs_at_risk_hit > 0) { |
|
|
|
|
//$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
|
|
|
//$message.=$table_resume; |
|
|
|
|
$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
|
|
|
//if ($wrong_results) { } |
|
|
|
|
$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
|
|
|
$message .= '<p>'.$comment.'</p>'; |
|
|
|
|
} else { |
|
|
|
|
$message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
|
|
|
$message .= $table_resume; |
|
|
|
|
$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
|
|
|
$message .= '<p>'.$comment.'</p>'; |
|
|
|
|
} |
|
|
|
|
echo $message; |
|
|
|
|
} else { |
|
|
|
|
echo '<p>'.$comment.'</p>'; |
|
|
|
|
} |
|
|
|
|
echo '<h3>'.$links.'</h3>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
Session::write('hot_spot_result', $message); |
|
|
|
|
$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
|
|
|
//reseting the exerciseResult variable |
|
|
|
|
Session::write('exerciseResult', $exerciseResult); |
|
|
|
|
|
|
|
|
@ -597,11 +597,11 @@ if ($links != '') { |
|
|
|
|
$_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
|
|
|
$_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
|
|
|
} else { |
|
|
|
|
$questionNum++; |
|
|
|
|
echo '<script> |
|
|
|
|
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
|
|
|
|
//self.parent.tb_remove(); |
|
|
|
|
</script>'; |
|
|
|
|
$questionNum++; |
|
|
|
|
echo '<script> |
|
|
|
|
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
|
|
|
|
//self.parent.tb_remove(); |
|
|
|
|
</script>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo '</div>'; |
|
|
|
|