|
|
|
@ -1,4 +1,5 @@ |
|
|
|
<?php // $Id: exercice_submit.php 20227 2009-04-30 16:40:35Z cvargas1 $
|
|
|
|
<?php |
|
|
|
|
|
|
|
// $Id: exercice_submit.php 20231 2009-04-30 18:08:12Z cvargas1 $ |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
============================================================================== |
|
|
|
============================================================================== |
|
|
|
@ -42,10 +43,9 @@ |
|
|
|
* @package dokeos.exercise |
|
|
|
* @package dokeos.exercise |
|
|
|
* @author Olivier Brouckaert |
|
|
|
* @author Olivier Brouckaert |
|
|
|
* @author Julio Montoya multiple fill in blank option added |
|
|
|
* @author Julio Montoya multiple fill in blank option added |
|
|
|
* @version $Id: exercice_submit.php 20227 2009-04-30 16:40:35Z cvargas1 $ |
|
|
|
* @version $Id: exercice_submit.php 20231 2009-04-30 18:08:12Z cvargas1 $ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include ('exercise.class.php'); |
|
|
|
include ('exercise.class.php'); |
|
|
|
include ('question.class.php'); |
|
|
|
include ('question.class.php'); |
|
|
|
include ('answer.class.php'); |
|
|
|
include ('answer.class.php'); |
|
|
|
@ -135,8 +135,7 @@ $exe_start_date= time(); |
|
|
|
$_SESSION['exercice_start_date'] = $exe_start_date; |
|
|
|
$_SESSION['exercice_start_date'] = $exe_start_date; |
|
|
|
} |
|
|
|
} |
|
|
|
// if the user has clicked on the "Cancel" button |
|
|
|
// if the user has clicked on the "Cancel" button |
|
|
|
if($buttonCancel) |
|
|
|
if ($buttonCancel) { |
|
|
|
{ |
|
|
|
|
|
|
|
// returns to the exercise list |
|
|
|
// returns to the exercise list |
|
|
|
header("Location: exercice.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); |
|
|
|
header("Location: exercice.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); |
|
|
|
exit (); |
|
|
|
exit (); |
|
|
|
@ -151,18 +150,38 @@ if ($origin == 'learnpath' && isset($_GET['not_multiple_attempt']) && $_GET['not |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($origin == 'builder') { |
|
|
|
if ($origin == 'builder') { |
|
|
|
/*******************************/ |
|
|
|
/*******************************/ |
|
|
|
/* Clears the exercise session */ |
|
|
|
/* Clears the exercise session */ |
|
|
|
/*******************************/ |
|
|
|
/*******************************/ |
|
|
|
if(isset($_SESSION['objExercise'])) { api_session_unregister('objExercise'); unset($objExercise); } |
|
|
|
if (isset ($_SESSION['objExercise'])) { |
|
|
|
if(isset($_SESSION['objQuestion'])) { api_session_unregister('objQuestion'); unset($objQuestion); } |
|
|
|
api_session_unregister('objExercise'); |
|
|
|
if(isset($_SESSION['objAnswer'])) { api_session_unregister('objAnswer'); unset($objAnswer); } |
|
|
|
unset ($objExercise); |
|
|
|
if(isset($_SESSION['questionList'])) { api_session_unregister('questionList'); unset($questionList); } |
|
|
|
} |
|
|
|
if(isset($_SESSION['newquestionList'])) { api_session_unregister('newquestionList'); unset($newquestionList); } |
|
|
|
if (isset ($_SESSION['objQuestion'])) { |
|
|
|
if(isset($_SESSION['exerciseResult'])) { api_session_unregister('exerciseResult'); unset($exerciseResult); } |
|
|
|
api_session_unregister('objQuestion'); |
|
|
|
if(isset($_SESSION['exerciseResultCoordinates'])) { api_session_unregister('exerciseResultCoordinates'); unset($exerciseResultCoordinates); } |
|
|
|
unset ($objQuestion); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset ($_SESSION['objAnswer'])) { |
|
|
|
|
|
|
|
api_session_unregister('objAnswer'); |
|
|
|
|
|
|
|
unset ($objAnswer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset ($_SESSION['questionList'])) { |
|
|
|
|
|
|
|
api_session_unregister('questionList'); |
|
|
|
|
|
|
|
unset ($questionList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset ($_SESSION['newquestionList'])) { |
|
|
|
|
|
|
|
api_session_unregister('newquestionList'); |
|
|
|
|
|
|
|
unset ($newquestionList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset ($_SESSION['exerciseResult'])) { |
|
|
|
|
|
|
|
api_session_unregister('exerciseResult'); |
|
|
|
|
|
|
|
unset ($exerciseResult); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset ($_SESSION['exerciseResultCoordinates'])) { |
|
|
|
|
|
|
|
api_session_unregister('exerciseResultCoordinates'); |
|
|
|
|
|
|
|
unset ($exerciseResultCoordinates); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$safe_lp_id = ($learnpath_id == '') ? 0 : (int) $learnpath_id; |
|
|
|
$safe_lp_id = ($learnpath_id == '') ? 0 : (int) $learnpath_id; |
|
|
|
$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : (int) $learnpath_item_id; |
|
|
|
$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : (int) $learnpath_item_id; |
|
|
|
@ -175,14 +194,12 @@ $condition = ' WHERE ' . |
|
|
|
'orig_lp_item_id = ' . "'" . $safe_lp_item_id . "'" . ' AND ' . |
|
|
|
'orig_lp_item_id = ' . "'" . $safe_lp_item_id . "'" . ' AND ' . |
|
|
|
'session_id = ' . "'" . (int) $_SESSION['id_session'] . "'"; |
|
|
|
'session_id = ' . "'" . (int) $_SESSION['id_session'] . "'"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST); |
|
|
|
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST); |
|
|
|
$result = api_sql_query("SELECT type,feedback_type FROM $TBL_EXERCICES WHERE id=$exerciseId", __FILE__, __LINE__); |
|
|
|
$result = api_sql_query("SELECT type,feedback_type FROM $TBL_EXERCICES WHERE id=$exerciseId", __FILE__, __LINE__); |
|
|
|
$exercise_row = Database :: fetch_array($result); |
|
|
|
$exercise_row = Database :: fetch_array($result); |
|
|
|
$exerciseType = $exercise_row['type']; |
|
|
|
$exerciseType = $exercise_row['type']; |
|
|
|
$exerciseFeedbackType = $exercise_row['feedback_type']; |
|
|
|
$exerciseFeedbackType = $exercise_row['feedback_type']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { |
|
|
|
if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { |
|
|
|
$query = 'SELECT * FROM ' . $stat_table . $condition; |
|
|
|
$query = 'SELECT * FROM ' . $stat_table . $condition; |
|
|
|
$result_select = api_sql_query($query, __FILE__, __LINE__); |
|
|
|
$result_select = api_sql_query($query, __FILE__, __LINE__); |
|
|
|
@ -220,7 +237,6 @@ if ($formSent) { |
|
|
|
$exerciseResultCoordinates = array (); |
|
|
|
$exerciseResultCoordinates = array (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if the user has answered at least one question |
|
|
|
// if the user has answered at least one question |
|
|
|
if (is_array($choice)) { |
|
|
|
if (is_array($choice)) { |
|
|
|
if ($debug > 0) { |
|
|
|
if ($debug > 0) { |
|
|
|
@ -303,7 +319,6 @@ if ($formSent) { |
|
|
|
$totalScore += $answerWeighting; |
|
|
|
$totalScore += $answerWeighting; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
// for multiple answers |
|
|
|
// for multiple answers |
|
|
|
case MULTIPLE_ANSWER : |
|
|
|
case MULTIPLE_ANSWER : |
|
|
|
@ -437,7 +452,8 @@ if ($formSent) { |
|
|
|
$totalScore += $answerWeighting[$i]; |
|
|
|
$totalScore += $answerWeighting[$i]; |
|
|
|
// adds the word in green at the end of the string |
|
|
|
// adds the word in green at the end of the string |
|
|
|
$answer .= stripslashes($user_tags[$i]); |
|
|
|
$answer .= stripslashes($user_tags[$i]); |
|
|
|
} elseif(!empty($user_tags[$i])) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (!empty ($user_tags[$i])) { |
|
|
|
// else if the word entered by the student IS NOT the same as the one defined by the professor |
|
|
|
// else if the word entered by the student IS NOT the same as the one defined by the professor |
|
|
|
// adds the word in red at the end of the string, and strikes it |
|
|
|
// adds the word in red at the end of the string, and strikes it |
|
|
|
$answer .= '<font color="red"><s>' . stripslashes($user_tags[$i]) . '</s></font>'; |
|
|
|
$answer .= '<font color="red"><s>' . stripslashes($user_tags[$i]) . '</s></font>'; |
|
|
|
@ -471,7 +487,8 @@ if ($formSent) { |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
$totalScore += $answerWeighting; |
|
|
|
$totalScore += $answerWeighting; |
|
|
|
$choice[$answerId] = $matching[$choice[$answerId]]; |
|
|
|
$choice[$answerId] = $matching[$choice[$answerId]]; |
|
|
|
} elseif(!$choice[$answerId]) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (!$choice[$answerId]) { |
|
|
|
$choice[$answerId] = ' '; |
|
|
|
$choice[$answerId] = ' '; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$choice[$answerId] = '<font color="red"><s>' . $matching[$choice[$answerId]] . '</s></font>'; |
|
|
|
$choice[$answerId] = '<font color="red"><s>' . $matching[$choice[$answerId]] . '</s></font>'; |
|
|
|
@ -481,7 +498,8 @@ if ($formSent) { |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
// for hotspot with no order |
|
|
|
// for hotspot with no order |
|
|
|
case HOT_SPOT : $studentChoice=$choice[$answerId]; |
|
|
|
case HOT_SPOT : |
|
|
|
|
|
|
|
$studentChoice = $choice[$answerId]; |
|
|
|
|
|
|
|
|
|
|
|
if ($studentChoice) { |
|
|
|
if ($studentChoice) { |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
@ -496,7 +514,8 @@ if ($formSent) { |
|
|
|
$result = api_sql_query($sql, __FILE__, __LINE__); |
|
|
|
$result = api_sql_query($sql, __FILE__, __LINE__); |
|
|
|
break; |
|
|
|
break; |
|
|
|
// for hotspot with fixed order |
|
|
|
// for hotspot with fixed order |
|
|
|
case HOT_SPOT_ORDER : $studentChoice=$choice['order'][$answerId]; |
|
|
|
case HOT_SPOT_ORDER : |
|
|
|
|
|
|
|
$studentChoice = $choice['order'][$answerId]; |
|
|
|
|
|
|
|
|
|
|
|
if ($studentChoice == $answerId) { |
|
|
|
if ($studentChoice == $answerId) { |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
$questionScore += $answerWeighting; |
|
|
|
@ -532,7 +551,8 @@ if ($formSent) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
exercise_attempt($questionScore, 0, $quesId, $exeId, 0); |
|
|
|
exercise_attempt($questionScore, 0, $quesId, $exeId, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} elseif ($answerType==MATCHING) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($answerType == MATCHING) { |
|
|
|
$j = sizeof($matching) + 1; |
|
|
|
$j = sizeof($matching) + 1; |
|
|
|
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($choice); $i++, $j++) { |
|
|
|
for ($i = 0; $i < sizeof($choice); $i++, $j++) { |
|
|
|
@ -552,10 +572,12 @@ if ($formSent) { |
|
|
|
exercise_attempt($questionScore, $answer, $quesId, $exeId, $j); |
|
|
|
exercise_attempt($questionScore, $answer, $quesId, $exeId, $j); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} elseif ($answerType==FREE_ANSWER) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($answerType == FREE_ANSWER) { |
|
|
|
$answer = $choice; |
|
|
|
$answer = $choice; |
|
|
|
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); |
|
|
|
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) . "'"; |
|
|
|
$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__); |
|
|
|
$res = api_sql_query($sql, __FILE__, __LINE__); |
|
|
|
$answer = Database :: result($res, 0, "id"); |
|
|
|
$answer = Database :: result($res, 0, "id"); |
|
|
|
@ -660,7 +682,9 @@ $table_quiz_test= Database :: get_course_table(TABLE_QUIZ_TEST); |
|
|
|
//in LP's is enabled the "remember question" feature? |
|
|
|
//in LP's is enabled the "remember question" feature? |
|
|
|
$my_exe_id = Security :: remove_XSS($_GET['exerciseId']); |
|
|
|
$my_exe_id = Security :: remove_XSS($_GET['exerciseId']); |
|
|
|
if (!isset ($_SESSION['questionList'])) { |
|
|
|
if (!isset ($_SESSION['questionList'])) { |
|
|
|
if ($debug>0){echo str_repeat(' ',0).'$_SESSION[questionList] was unset'."<br />\n";} |
|
|
|
if ($debug > 0) { |
|
|
|
|
|
|
|
echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset' . "<br />\n"; |
|
|
|
|
|
|
|
} |
|
|
|
// selects the list of question ID |
|
|
|
// selects the list of question ID |
|
|
|
$my_question_list = array (); |
|
|
|
$my_question_list = array (); |
|
|
|
$questionList = ($randomQuestions ? $objExercise->selectRandomList() : $objExercise->selectQuestionList()); |
|
|
|
$questionList = ($randomQuestions ? $objExercise->selectRandomList() : $objExercise->selectQuestionList()); |
|
|
|
@ -683,7 +707,9 @@ if (!isset($_SESSION['questionList'])) { |
|
|
|
$questionList = $my_question_list; |
|
|
|
$questionList = $my_question_list; |
|
|
|
} |
|
|
|
} |
|
|
|
api_session_register('questionList'); |
|
|
|
api_session_register('questionList'); |
|
|
|
if ($debug>0){echo str_repeat(' ',0).'$_SESSION[questionList] was unset - set now - end'."<br />\n";} |
|
|
|
if ($debug > 0) { |
|
|
|
|
|
|
|
echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset - set now - end' . "<br />\n"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { |
|
|
|
if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { |
|
|
|
$questionList = $_SESSION['questionList']; |
|
|
|
$questionList = $_SESSION['questionList']; |
|
|
|
@ -705,7 +731,8 @@ if(!$questionNum || $_POST['questionNum']) { |
|
|
|
if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
|
|
|
if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
|
|
|
$_SESSION['gradebook'] = Security :: remove_XSS($_GET['gradebook']); |
|
|
|
$_SESSION['gradebook'] = Security :: remove_XSS($_GET['gradebook']); |
|
|
|
$gradebook = $_SESSION['gradebook']; |
|
|
|
$gradebook = $_SESSION['gradebook']; |
|
|
|
} elseif (empty($_GET['gradebook'])) { |
|
|
|
} |
|
|
|
|
|
|
|
elseif (empty ($_GET['gradebook'])) { |
|
|
|
unset ($_SESSION['gradebook']); |
|
|
|
unset ($_SESSION['gradebook']); |
|
|
|
$gradebook = ''; |
|
|
|
$gradebook = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -718,8 +745,14 @@ if (!empty($gradebook) && $gradebook=='view') { |
|
|
|
} |
|
|
|
} |
|
|
|
//$nameTools=get_lang('Exercice'); |
|
|
|
//$nameTools=get_lang('Exercice'); |
|
|
|
|
|
|
|
|
|
|
|
$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); |
|
|
|
$interbreadcrumb[] = array ( |
|
|
|
$interbreadcrumb[]=array("url" => "#","name" => $exerciseTitle); |
|
|
|
"url" => "exercice.php?gradebook=$gradebook", |
|
|
|
|
|
|
|
"name" => get_lang('Exercices') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$interbreadcrumb[] = array ( |
|
|
|
|
|
|
|
"url" => api_get_self()."?gradebook=$gradebook", |
|
|
|
|
|
|
|
"name" => $exerciseTitle |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ($origin != 'learnpath') { //so we are not in learnpath tool |
|
|
|
if ($origin != 'learnpath') { //so we are not in learnpath tool |
|
|
|
|
|
|
|
|
|
|
|
@ -836,18 +869,14 @@ $htmlHeadXtra[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/Java |
|
|
|
// --> |
|
|
|
// --> |
|
|
|
</script>"; |
|
|
|
</script>"; |
|
|
|
Display :: display_header($nameTools, "Exercise"); |
|
|
|
Display :: display_header($nameTools, "Exercise"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
if (empty ($charset)) { |
|
|
|
{ |
|
|
|
|
|
|
|
if(empty($charset)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$charset = 'ISO-8859-15'; |
|
|
|
$charset = 'ISO-8859-15'; |
|
|
|
} |
|
|
|
} |
|
|
|
header('Content-Type: text/html; charset=' . $charset); |
|
|
|
header('Content-Type: text/html; charset=' . $charset); |
|
|
|
|
|
|
|
|
|
|
|
@ $document_language = Database :: get_language_isocode($language_interface); |
|
|
|
@ $document_language = Database :: get_language_isocode($language_interface); |
|
|
|
if(empty($document_language)) |
|
|
|
if (empty ($document_language)) { |
|
|
|
{ |
|
|
|
|
|
|
|
//if there was no valid iso-code, use the english one |
|
|
|
//if there was no valid iso-code, use the english one |
|
|
|
$document_language = 'en'; |
|
|
|
$document_language = 'en'; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -855,7 +884,6 @@ else |
|
|
|
/* |
|
|
|
/* |
|
|
|
* HTML HEADER |
|
|
|
* HTML HEADER |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
|
?> |
|
|
|
<!DOCTYPE html |
|
|
|
<!DOCTYPE html |
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
|
|
@ -870,6 +898,7 @@ else |
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/default.css'; ?>" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/default.css'; ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// I'm in a preview mode |
|
|
|
// I'm in a preview mode |
|
|
|
@ -925,7 +954,8 @@ if($limit_time_exists){ |
|
|
|
$exercise_end_time = convert_date_to_number($Exe_endtime); |
|
|
|
$exercise_end_time = convert_date_to_number($Exe_endtime); |
|
|
|
$time_now = convert_date_to_number(date('Y-m-d H:i:s')); |
|
|
|
$time_now = convert_date_to_number(date('Y-m-d H:i:s')); |
|
|
|
$permission_to_start = (($time_now - $exercise_start_time) > 0) ? true : false; |
|
|
|
$permission_to_start = (($time_now - $exercise_start_time) > 0) ? true : false; |
|
|
|
if($_SERVER['REQUEST_METHOD']!='POST')$exercise_timeover = (($time_now - $exercise_end_time)>0)?true:false; |
|
|
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
|
|
|
|
|
|
$exercise_timeover = (($time_now - $exercise_end_time) > 0) ? true : false; |
|
|
|
if ($permission_to_start == false || $exercise_timeover == true) { // |
|
|
|
if ($permission_to_start == false || $exercise_timeover == true) { // |
|
|
|
if (!api_is_allowed_to_edit()) { |
|
|
|
if (!api_is_allowed_to_edit()) { |
|
|
|
$message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit'); |
|
|
|
$message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit'); |
|
|
|
@ -939,15 +969,12 @@ if($limit_time_exists){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!empty($error)) |
|
|
|
if (!empty ($error)) { |
|
|
|
{ |
|
|
|
|
|
|
|
Display :: display_error_message($error, false); |
|
|
|
Display :: display_error_message($error, false); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!empty ($exerciseSound)) { |
|
|
|
if (!empty ($exerciseSound)) { |
|
|
|
echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F".$exerciseSound."\" target=\"_blank\">", |
|
|
|
echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F" . $exerciseSound . "\" target=\"_blank\">", "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound') . |
|
|
|
"<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=",get_lang('Sound')."\" /></a>"; |
|
|
|
"\" /></a>"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get number of hotspot questions for javascript validation |
|
|
|
// Get number of hotspot questions for javascript validation |
|
|
|
@ -965,28 +992,21 @@ else |
|
|
|
// if it is not the right question, goes to the next loop iteration |
|
|
|
// if it is not the right question, goes to the next loop iteration |
|
|
|
if ($questionNum != $i) { |
|
|
|
if ($questionNum != $i) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
if ($objQuestionTmp->selectType() == HOT_SPOT) { |
|
|
|
{ |
|
|
|
|
|
|
|
if ($objQuestionTmp->selectType() == HOT_SPOT) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$number_of_hotspot_questions++; |
|
|
|
$number_of_hotspot_questions++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
if ($objQuestionTmp->selectType() == HOT_SPOT) { |
|
|
|
{ |
|
|
|
|
|
|
|
if ($objQuestionTmp->selectType() == HOT_SPOT) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$number_of_hotspot_questions++; |
|
|
|
$number_of_hotspot_questions++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if($number_of_hotspot_questions > 0) |
|
|
|
if ($number_of_hotspot_questions > 0) { |
|
|
|
{ |
|
|
|
|
|
|
|
$onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\""; |
|
|
|
$onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\""; |
|
|
|
} |
|
|
|
} |
|
|
|
$s = "<p>$exerciseDescription</p>"; |
|
|
|
$s = "<p>$exerciseDescription</p>"; |
|
|
|
@ -995,7 +1015,7 @@ else |
|
|
|
$s2 = "&exerciseId=" . $exerciseId; |
|
|
|
$s2 = "&exerciseId=" . $exerciseId; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$s.=" <form method='post' action='".api_get_self()."?autocomplete=off".$s2."' name='frm_exercise' $onsubmit> |
|
|
|
$s .= " <form method='post' action='" . api_get_self() . "?autocomplete=off&gradebook=$gradebook" . $s2 . "' name='frm_exercise' $onsubmit> |
|
|
|
<input type='hidden' name='formSent' value='1' /> |
|
|
|
<input type='hidden' name='formSent' value='1' /> |
|
|
|
<input type='hidden' name='exerciseType' value='" . $exerciseType . "' /> |
|
|
|
<input type='hidden' name='exerciseType' value='" . $exerciseType . "' /> |
|
|
|
<input type='hidden' name='exerciseId' value='" . $exerciseId . "' /> |
|
|
|
<input type='hidden' name='exerciseId' value='" . $exerciseId . "' /> |
|
|
|
@ -1060,19 +1080,11 @@ else |
|
|
|
$('.rounded_inner').corners(); |
|
|
|
$('.rounded_inner').corners(); |
|
|
|
});</script>"; |
|
|
|
});</script>"; |
|
|
|
//echo '<br /><span class="rounded" style="width: 300px; margin-top: 10px; padding: 3px; background-color:#ccc;"><span style="width: 300px" class="rounded_inner" ><a href="exercise_submit_modal.php?hotspot='.$hotspot_get.'&nbrQuestions='.$nbrQuestions.'&questionnum='.$questionNum.'&exerciseType='.$exerciseType.'&exerciseId='.$exerciseId.'&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=480&width=640&modal=true" title="" class="thickbox" id="validationButton">'.get_lang('ValidateAnswer').'</a></span></span><br /><br /><br />'; |
|
|
|
//echo '<br /><span class="rounded" style="width: 300px; margin-top: 10px; padding: 3px; background-color:#ccc;"><span style="width: 300px" class="rounded_inner" ><a href="exercise_submit_modal.php?hotspot='.$hotspot_get.'&nbrQuestions='.$nbrQuestions.'&questionnum='.$questionNum.'&exerciseType='.$exerciseType.'&exerciseId='.$exerciseId.'&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=480&width=640&modal=true" title="" class="thickbox" id="validationButton">'.get_lang('ValidateAnswer').'</a></span></span><br /><br /><br />'; |
|
|
|
echo '<br /> |
|
|
|
|
|
|
|
<div class="rounded" style="text-align: center;"> |
|
|
|
|
|
|
|
<div class="rounded_inner"> |
|
|
|
|
|
|
|
<a href="exercise_submit_modal.php?hotspot='.$hotspot_get.'&nbrQuestions='.$nbrQuestions.'&questionnum='.$questionNum.'&exerciseType='.$exerciseType.'&exerciseId='.$exerciseId.'&origin='.$origin.'&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=480&width=640&modal=true" title="" class="thickbox" id="validationButton">'.get_lang('ValidateAnswer').'</a> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div><br /><br /><br />'; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if ($exerciseType == 1 || $nbrQuestions == $questionNum) |
|
|
|
if ($exerciseType == 1 || $nbrQuestions == $questionNum) { |
|
|
|
{ |
|
|
|
|
|
|
|
$submit_btn .= get_lang('ValidateAnswer'); |
|
|
|
$submit_btn .= get_lang('ValidateAnswer'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$submit_btn .= get_lang('NextQuestion'); |
|
|
|
$submit_btn .= get_lang('NextQuestion'); |
|
|
|
} |
|
|
|
} |
|
|
|
$submit_btn .= "</button>"; |
|
|
|
$submit_btn .= "</button>"; |
|
|
|
|