Exercises: Showing message to the admin/teacher if the document/images folder is invisible when using hotspot questions

skala
Julio Montoya 15 years ago
parent 4c009de082
commit f039815a96
  1. 12
      main/exercice/exercice_submit.php
  2. 26
      main/exercice/exercise.class.php
  3. 13
      main/exercice/exercise.lib.php
  4. 3
      main/exercice/exercise_result.php
  5. 2
      main/inc/lib/events.lib.inc.php
  6. 15
      main/inc/lib/exercise_show_functions.lib.php

@ -25,8 +25,6 @@ require_once 'question.class.php';
require_once 'answer.class.php';
require_once 'exercise.lib.php';
// debug var. Set to 0 to hide all debug display. Set to 1 to display debug messages.
$debug = 1;
@ -62,6 +60,8 @@ if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
}
//@todo we should only enable this when there is a time control
//This library is necessary for the time control feature
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.epiclock.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
@ -162,9 +162,9 @@ if ($origin == 'builder') {
}
}
$safe_lp_id = ($learnpath_id == '') ? 0 : $learnpath_id;
$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : $learnpath_item_id;
$safe_lp_item_view_id = ($learnpath_item_view_id == '') ? 0 : $learnpath_item_view_id;
$safe_lp_id = ($learnpath_id == '') ? 0 : $learnpath_id;
$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : $learnpath_item_id;
$safe_lp_item_view_id = ($learnpath_item_view_id == '') ? 0 : $learnpath_item_view_id;
// Loading the $objExercise variable
@ -469,7 +469,7 @@ $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name"
$interbreadcrumb[] = array ("url" => api_get_self()."?gradebook=$gradebook","name" => $objExercise->selectTitle());
if ($origin != 'learnpath') { //so we are not in learnpath tool
$htmlHeadXtra[] = $objExercise->show_lp_javascript();
//$htmlHeadXtra[] = $objExercise->show_lp_javascript();
Display :: display_header($nameTools,get_lang('Exercises'));
if (!api_is_allowed_to_session_edit() ) {
Display :: display_warning_message(get_lang('SessionIsReadOnly'));

@ -1635,10 +1635,14 @@ class Exercise {
/**
* This function was originally found in the exercise_show.php
* @param int exe id
* @param int question id
* @param int the choice the user selected
* @param int exe id
* @param int question id
* @param int the choice the user selected
* @param string function is called from 'exercise_show' or 'exercise_result'
* @param bool save results in the DB or just show the reponse
* @param bool gets information from DB or from the current selection
* @param bool show results or not
* @return string html code
*/
function manage_answer($exeId, $questionId, $choice, $from = 'exercise_show', $saved_results = true, $from_database = false, $show_result = true) {
global $_configuration;
@ -1685,8 +1689,7 @@ class Exercise {
$answer_matching[$real_answer['id']]= $real_answer['answer'];
}
$real_answers = array();
$real_answers = array();
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
@ -2029,7 +2032,7 @@ class Exercise {
echo '</tr>';
}
}
break(2); //break the switch and the for condition
break(2); //break the switch and the "for" condition
} else {
$numAnswer=$objAnswerTmp->selectAutoId($answerId);
if ($answerCorrect) {
@ -2078,9 +2081,11 @@ class Exercise {
global $origin;
if ($show_result) {
if ($show_result) {
if ($from == 'exercise_result') {
//display answers (if not matching type, or if the answer is correct)
if ($answerType != MATCHING || $answerCorrect) {
if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_COMBINATION) {
if ($origin!='learnpath') {
@ -2097,8 +2102,7 @@ class Exercise {
if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice,0,0);
}
} elseif($answerType == HOT_SPOT) {
exit;
} elseif($answerType == HOT_SPOT) {
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
}
@ -2112,7 +2116,7 @@ class Exercise {
}
}
}
} else {
} else {
switch($answerType) {
case UNIQUE_ANSWER :
case MULTIPLE_ANSWER :
@ -2135,7 +2139,7 @@ class Exercise {
</table>';
break;
case HOT_SPOT:
//ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
break;
case HOT_SPOT_ORDER:
ExerciseShowFunctions::display_hotspot_order_answer($answerId, $answer, $studentChoice, $answerComment);

@ -293,6 +293,19 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
} elseif ($answerType == HOT_SPOT) {
// Question is of type HOT_SPOT
//checking document/images visibility
if (api_is_platform_admin() || api_is_course_admin()) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
$course = api_get_course_info();
$doc_id = DocumentManager::get_document_id($course, '/images');
if (is_numeric($doc_id)) {
$images_folder_visibility = api_get_item_visibility($course,'document', $doc_id, api_get_session_id());
if (!$images_folder_visibility) {
Display::display_warning_message(get_lang('ChangeTheVisibilityOfTheDocumentImagesFolder'));
}
}
}
$questionName = $objQuestionTmp->selectTitle();
$questionDescription = $objQuestionTmp->selectDescription();

@ -115,7 +115,7 @@ if (!empty($gradebook) && $gradebook=='view') {
$nameTools=get_lang('Exercice');
$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$htmlHeadXtra[] = $objExercise->show_lp_javascript();
//$htmlHeadXtra[] = $objExercise->show_lp_javascript();
if ($origin != 'learnpath') {
//so we are not in learnpath tool
@ -274,7 +274,6 @@ foreach ($questionList as $questionId) {
<td width="152" valign="top">
<i><?php echo get_lang("CorrectAnswer"); ?></i><br /><br />
</td>
<td width="100" valign="top">
<i><?php echo get_lang('HotspotHit'); ?></i><br /><br />
</td>

@ -494,7 +494,7 @@ function exercise_attempt($score, $answer, $quesId, $exeId, $j, $exercise_id = 0
'".$j."',
'".$reallyNow."'
)";
error_log($sql);
if (!empty($quesId) && !empty($exeId) && !empty($user_id)) {
$res = Database::query($sql);
if (defined('ENABLED_LIVE_EXERCISE_TRACKING')){

@ -188,18 +188,13 @@ class ExerciseShowFunctions {
<td width="20%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=text_filter($answerComment);
if($studentChoice)
{
if(!$answerCorrect)
{
if($studentChoice) {
if(!$answerCorrect) {
echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br(make_clickable($answerComment)).'</span>';
} else {
echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable($answerComment)).'</span>';
}
else{
echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable($answerComment)).'</span>';
}
}
else
{
} else {
echo '&nbsp;';
}
?>

Loading…
Cancel
Save