diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 35def20887..7e53fc95d7 100644 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -1,4 +1,5 @@ - 0 ){ - $getIncomplete = Database::fetch_array($result_select); - $exe_id = $getIncomplete['exe_id']; - if ($_SERVER['REQUEST_METHOD']!='POST') { - define('QUESTION_LIST_ALREADY_LOGGED',1); - $recorded['questionList'] = explode(',',$getIncomplete['data_tracking']); - $query = 'SELECT * FROM '.$exercice_attemp_table.' WHERE exe_id = '.$getIncomplete['exe_id'].' ORDER BY tms ASC'; - $result = api_sql_query($query,__FILE__,__LINE__); - while ($row = Database::fetch_array($result)) { +$exerciseFeedbackType = $exercise_row['feedback_type']; + +if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { + $query = 'SELECT * FROM ' . $stat_table . $condition; + $result_select = api_sql_query($query, __FILE__, __LINE__); + if (Database :: num_rows($result_select) > 0) { + $getIncomplete = Database :: fetch_array($result_select); + $exe_id = $getIncomplete['exe_id']; + if ($_SERVER['REQUEST_METHOD'] != 'POST') { + define('QUESTION_LIST_ALREADY_LOGGED', 1); + $recorded['questionList'] = explode(',', $getIncomplete['data_tracking']); + $query = 'SELECT * FROM ' . $exercice_attemp_table . ' WHERE exe_id = ' . $getIncomplete['exe_id'] . ' ORDER BY tms ASC'; + $result = api_sql_query($query, __FILE__, __LINE__); + while ($row = Database :: fetch_array($result)) { $recorded['exerciseResult'][$row['question_id']] = 1; } $exerciseResult = $_SESSION['exerciseResult'] = $recorded['exerciseResult']; @@ -210,507 +227,517 @@ if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $ // if the user has submitted the form if ($formSent) { - if ($debug>0) { - echo str_repeat(' ',0).'$formSent was set'."
\n"; - } - - // initializing - if (!is_array($exerciseResult)) { - $exerciseResult=array(); - $exerciseResultCoordinates=array(); - } - - - // if the user has answered at least one question - if (is_array($choice)) { - if ($debug>0) { - echo str_repeat(' ',0).'$choice is an array'."
\n"; - } - - if ($exerciseType == 1) { - // $exerciseResult receives the content of the form. - // Each choice of the student is stored into the array $choice - $exerciseResult=$choice; - - if (isset($_POST['hotspot'])) { - $exerciseResultCoordinates = $_POST['hotspot']; - } - } else { - // gets the question ID from $choice. It is the key of the array - list($key)=array_keys($choice); - - // if the user didn't already answer this question - if (!isset($exerciseResult[$key])) { - // stores the user answer into the array - $exerciseResult[$key]=$choice[$key]; - - //saving each question - if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType!=1) { - - $nro_question = $questionNum;// - 1; - - //START of saving and qualifying each question submitted - //------------------------------------------------------------------------------------------ - // - define('ENABLED_LIVE_EXERCISE_TRACKING',1); + if ($debug > 0) { + echo str_repeat(' ', 0) . '$formSent was set' . "
\n"; + } + + // initializing + if (!is_array($exerciseResult)) { + $exerciseResult = array (); + $exerciseResultCoordinates = array (); + } + + // if the user has answered at least one question + if (is_array($choice)) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$choice is an array' . "
\n"; + } + + if ($exerciseType == 1) { + // $exerciseResult receives the content of the form. + // Each choice of the student is stored into the array $choice + $exerciseResult = $choice; + + if (isset ($_POST['hotspot'])) { + $exerciseResultCoordinates = $_POST['hotspot']; + } + } else { + // gets the question ID from $choice. It is the key of the array + list ($key) = array_keys($choice); + + // if the user didn't already answer this question + if (!isset ($exerciseResult[$key])) { + // stores the user answer into the array + $exerciseResult[$key] = $choice[$key]; + + //saving each question + if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { + + $nro_question = $questionNum; // - 1; + + //START of saving and qualifying each question submitted + //------------------------------------------------------------------------------------------ + // + define('ENABLED_LIVE_EXERCISE_TRACKING', 1); require_once 'question.class.php'; require_once 'answer.class.php'; - require_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); - $counter=0; + require_once (api_get_path(LIBRARY_PATH) . 'events.lib.inc.php'); + $counter = 0; $main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); - $table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER); + $table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER); //foreach($questionList as $questionId) if (true) { $exeId = $exe_id; $questionId = $key; $counter++; // gets the student choice for this question - $choice=$exerciseResult[$questionId]; - + $choice = $exerciseResult[$questionId]; + // creates a temporary Question object $objQuestionTmp = Question :: read($questionId); - - $questionName=$objQuestionTmp->selectTitle(); - $questionDescription=$objQuestionTmp->selectDescription(); - $questionWeighting=$objQuestionTmp->selectWeighting(); - $answerType=$objQuestionTmp->selectType(); - $quesId =$objQuestionTmp->selectId(); //added by priya saini - + + $questionName = $objQuestionTmp->selectTitle(); + $questionDescription = $objQuestionTmp->selectDescription(); + $questionWeighting = $objQuestionTmp->selectWeighting(); + $answerType = $objQuestionTmp->selectType(); + $quesId = $objQuestionTmp->selectId(); //added by priya saini + // destruction of the Question object - unset($objQuestionTmp); - + unset ($objQuestionTmp); + // construction of the Answer object - $objAnswerTmp=new Answer($questionId); - $nbrAnswers=$objAnswerTmp->selectNbrAnswers(); - $questionScore=0; + $objAnswerTmp = new Answer($questionId); + $nbrAnswers = $objAnswerTmp->selectNbrAnswers(); + $questionScore = 0; if ($answerType == FREE_ANSWER) { $nbrAnswers = 1; } - - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { - $answer=$objAnswerTmp->selectAnswer($answerId); - $answerComment=$objAnswerTmp->selectComment($answerId); - $answerCorrect=$objAnswerTmp->isCorrect($answerId); - $answerWeighting=$objAnswerTmp->selectWeighting($answerId); - + + for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { + $answer = $objAnswerTmp->selectAnswer($answerId); + $answerComment = $objAnswerTmp->selectComment($answerId); + $answerCorrect = $objAnswerTmp->isCorrect($answerId); + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); + switch ($answerType) { // for unique answer case UNIQUE_ANSWER : - $studentChoice=($choice == $answerId)?1:0; - - if ($studentChoice) { - $questionScore+=$answerWeighting; - $totalScore+=$answerWeighting; - } - - - break; - // for multiple answers + $studentChoice = ($choice == $answerId) ? 1 : 0; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + + break; + // for multiple answers case MULTIPLE_ANSWER : - - $studentChoice=$choice[$answerId]; - - if ($studentChoice) { - $questionScore+=$answerWeighting; - $totalScore+=$answerWeighting; - } - - break; - // for fill in the blanks + + $studentChoice = $choice[$answerId]; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + + break; + // for fill in the blanks case FILL_IN_BLANKS : - - // the question is encoded like this - // [A] B [C] D [E] F::10,10,10@1 - // number 1 before the "@" means that is a switchable fill in blank question - // [A] B [C] D [E] F::10,10,10@ or [A] B [C] D [E] F::10,10,10 - // means that is a normal fill blank question - - // first we explode the "::" - $pre_array = explode('::', $answer); - - // is switchable fill blank or not - $last = count($pre_array)-1; - $is_set_switchable = explode('@', $pre_array[$last]); - - $switchable_answer_set=false; - if (isset($is_set_switchable[1]) && $is_set_switchable[1]==1) { - $switchable_answer_set=true; - } - - $answer = ''; - for ($k=0; $k<$last; $k++) { - $answer .= $pre_array[$k]; - } - - // splits weightings that are joined with a comma - $answerWeighting = explode(',',$is_set_switchable[0]); - - // we save the answer because it will be modified - $temp=$answer; - - // TeX parsing - // 1. find everything between the [tex] and [/tex] tags - $startlocations=strpos($temp,'[tex]'); - $endlocations=strpos($temp,'[/tex]'); - - if ($startlocations !== false && $endlocations !== false) { - $texstring=substr($temp,$startlocations,$endlocations-$startlocations+6); - // 2. replace this by {texcode} - $temp=str_replace($texstring,'{texcode}',$temp); - } - - $answer=''; - $j=0; - - //initialise answer tags - $user_tags=array(); - $correct_tags=array(); - $real_text=array(); - // the loop will stop at the end of the text - while (1) { - // quits the loop if there are no more blanks (detect '[') - if (($pos = strpos($temp,'[')) === false) { - // adds the end of the text - $answer=$temp; - // TeX parsing - replacement of texcode tags - $texstring = api_parse_tex($texstring); - $answer=str_replace("{texcode}",$texstring,$answer); - $real_text[] = $answer; - break; //no more "blanks", quit the loop - } - // adds the piece of text that is before the blank - //and ends with '[' into a general storage array - $real_text[]=substr($temp,0,$pos+1); - $answer.=substr($temp,0,$pos+1); - //take the string remaining (after the last "[" we found) - $temp=substr($temp,$pos+1); - // quit the loop if there are no more blanks, and update $pos to the position of next ']' - if (($pos = strpos($temp,']')) === false) { - // adds the end of the text - $answer.=$temp; - break; - } - $choice[$j]=trim($choice[$j]); - $user_tags[]=stripslashes(strtolower($choice[$j])); - //put the contents of the [] answer tag into correct_tags[] - $correct_tags[]=strtolower(substr($temp,0,$pos)); - $j++; - $temp=substr($temp,$pos+1); - //$answer .= ']'; - } - - $answer=''; - $real_correct_tags = $correct_tags; - $chosen_list=array(); - - for ($i=0;$i'; - } else { - // adds a tabulation if no word has been typed by the student - $answer.='   '; - } - } else { - // switchable fill in the blanks - if (in_array($user_tags[$i],$correct_tags)) { - $chosen_list[]=$user_tags[$i]; - $correct_tags=array_diff($correct_tags,$chosen_list); - - // gives the related weighting to the student - $questionScore+=$answerWeighting[$i]; - // increments total score - $totalScore+=$answerWeighting[$i]; - // adds the word in green at the end of the string - $answer.=stripslashes($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 - // adds the word in red at the end of the string, and strikes it - $answer.=''.stripslashes($user_tags[$i]).''; - } else { - // adds a tabulation if no word has been typed by the student - $answer.='   '; - } - } - // adds the correct word, followed by ] to close the blank - $answer.=' / '.$real_correct_tags[$i].']'; - if ( isset( $real_text[$i+1] ) ) { - $answer.=$real_text[$i+1]; - } - } - - break; - // for free answer + + // the question is encoded like this + // [A] B [C] D [E] F::10,10,10@1 + // number 1 before the "@" means that is a switchable fill in blank question + // [A] B [C] D [E] F::10,10,10@ or [A] B [C] D [E] F::10,10,10 + // means that is a normal fill blank question + + // first we explode the "::" + $pre_array = explode('::', $answer); + + // is switchable fill blank or not + $last = count($pre_array) - 1; + $is_set_switchable = explode('@', $pre_array[$last]); + + $switchable_answer_set = false; + if (isset ($is_set_switchable[1]) && $is_set_switchable[1] == 1) { + $switchable_answer_set = true; + } + + $answer = ''; + for ($k = 0; $k < $last; $k++) { + $answer .= $pre_array[$k]; + } + + // splits weightings that are joined with a comma + $answerWeighting = explode(',', $is_set_switchable[0]); + + // we save the answer because it will be modified + $temp = $answer; + + // TeX parsing + // 1. find everything between the [tex] and [/tex] tags + $startlocations = strpos($temp, '[tex]'); + $endlocations = strpos($temp, '[/tex]'); + + if ($startlocations !== false && $endlocations !== false) { + $texstring = substr($temp, $startlocations, $endlocations - $startlocations +6); + // 2. replace this by {texcode} + $temp = str_replace($texstring, '{texcode}', $temp); + } + + $answer = ''; + $j = 0; + + //initialise answer tags + $user_tags = array (); + $correct_tags = array (); + $real_text = array (); + // the loop will stop at the end of the text + while (1) { + // quits the loop if there are no more blanks (detect '[') + if (($pos = strpos($temp, '[')) === false) { + // adds the end of the text + $answer = $temp; + // TeX parsing - replacement of texcode tags + $texstring = api_parse_tex($texstring); + $answer = str_replace("{texcode}", $texstring, $answer); + $real_text[] = $answer; + break; //no more "blanks", quit the loop + } + // adds the piece of text that is before the blank + //and ends with '[' into a general storage array + $real_text[] = substr($temp, 0, $pos +1); + $answer .= substr($temp, 0, $pos +1); + //take the string remaining (after the last "[" we found) + $temp = substr($temp, $pos +1); + // quit the loop if there are no more blanks, and update $pos to the position of next ']' + if (($pos = strpos($temp, ']')) === false) { + // adds the end of the text + $answer .= $temp; + break; + } + $choice[$j] = trim($choice[$j]); + $user_tags[] = stripslashes(strtolower($choice[$j])); + //put the contents of the [] answer tag into correct_tags[] + $correct_tags[] = strtolower(substr($temp, 0, $pos)); + $j++; + $temp = substr($temp, $pos +1); + //$answer .= ']'; + } + + $answer = ''; + $real_correct_tags = $correct_tags; + $chosen_list = array (); + + for ($i = 0; $i < count($real_correct_tags); $i++) { + if ($i == 0) { + $answer .= $real_text[0]; + } + + if (!$switchable_answer_set) { + if ($correct_tags[$i] == $user_tags[$i]) { + // gives the related weighting to the student + $questionScore += $answerWeighting[$i]; + // increments total score + $totalScore += $answerWeighting[$i]; + // adds the word in green at the end of the string + $answer .= stripslashes($correct_tags[$i]); + } + // else if the word entered by the student IS NOT the same as the one defined by the professor + elseif (!empty ($user_tags[$i])) { + // adds the word in red at the end of the string, and strikes it + $answer .= '' . stripslashes($user_tags[$i]) . ''; + } else { + // adds a tabulation if no word has been typed by the student + $answer .= '   '; + } + } else { + // switchable fill in the blanks + if (in_array($user_tags[$i], $correct_tags)) { + $chosen_list[] = $user_tags[$i]; + $correct_tags = array_diff($correct_tags, $chosen_list); + + // gives the related weighting to the student + $questionScore += $answerWeighting[$i]; + // increments total score + $totalScore += $answerWeighting[$i]; + // adds the word in green at the end of the string + $answer .= stripslashes($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 + // adds the word in red at the end of the string, and strikes it + $answer .= '' . stripslashes($user_tags[$i]) . ''; + } else { + // adds a tabulation if no word has been typed by the student + $answer .= '   '; + } + } + // adds the correct word, followed by ] to close the blank + $answer .= ' / ' . $real_correct_tags[$i] . ']'; + if (isset ($real_text[$i +1])) { + $answer .= $real_text[$i +1]; + } + } + + break; + // for free answer case FREE_ANSWER : - $studentChoice=$choice; - - if ($studentChoice) { - //Score is at -1 because the question has'nt been corected - $questionScore=-1; - $totalScore+=0; - } - break; - // for matching + $studentChoice = $choice; + + if ($studentChoice) { + //Score is at -1 because the question has'nt been corected + $questionScore = -1; + $totalScore += 0; + } + break; + // for matching case MATCHING : - if ($answerCorrect) { - if ($answerCorrect == $choice[$answerId]) { - $questionScore+=$answerWeighting; - $totalScore+=$answerWeighting; - $choice[$answerId]=$matching[$choice[$answerId]]; - } elseif(!$choice[$answerId]) { - $choice[$answerId]='   '; - } else { - $choice[$answerId]=''.$matching[$choice[$answerId]].''; - } - } else { - $matching[$answerId]=$answer; - } - break; - // for hotspot with no order - case HOT_SPOT : $studentChoice=$choice[$answerId]; - - if($studentChoice) { - $questionScore+=$answerWeighting; - $totalScore+=$answerWeighting; - } - - $tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); - // Save into db - $sql = "INSERT INTO $tbl_track_e_hotspot (`hotspot_user_id` , `hotspot_course_code` , `hotspot_exe_id` , `hotspot_question_id` , `hotspot_answer_id` , `hotspot_correct` , `hotspot_coordinate` ) - VALUES ('".Database::escape_string($_user['user_id'])."', '".Database::escape_string($_course['id'])."', '".Database::escape_string($exeId)."', '".Database::escape_string($questionId)."', '".Database::escape_string($answerId)."', '".Database::escape_string($studentChoice)."', '".Database::escape_string($_SESSION['exerciseResultCoordinates'][$questionId][$answerId])."')"; - - $result = api_sql_query($sql,__FILE__,__LINE__); - break; - // for hotspot with fixed order - case HOT_SPOT_ORDER : $studentChoice=$choice['order'][$answerId]; - - if ($studentChoice == $answerId) { - $questionScore+=$answerWeighting; - $totalScore+=$answerWeighting; - $studentChoice = true; - } else { - $studentChoice = false; - } - break; + if ($answerCorrect) { + if ($answerCorrect == $choice[$answerId]) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + $choice[$answerId] = $matching[$choice[$answerId]]; + } + elseif (!$choice[$answerId]) { + $choice[$answerId] = '   '; + } else { + $choice[$answerId] = '' . $matching[$choice[$answerId]] . ''; + } + } else { + $matching[$answerId] = $answer; + } + break; + // for hotspot with no order + case HOT_SPOT : + $studentChoice = $choice[$answerId]; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + + $tbl_track_e_hotspot = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); + // Save into db + $sql = "INSERT INTO $tbl_track_e_hotspot (`hotspot_user_id` , `hotspot_course_code` , `hotspot_exe_id` , `hotspot_question_id` , `hotspot_answer_id` , `hotspot_correct` , `hotspot_coordinate` ) + VALUES ('" . Database :: escape_string($_user['user_id']) . "', '" . Database :: escape_string($_course['id']) . "', '" . Database :: escape_string($exeId) . "', '" . Database :: escape_string($questionId) . "', '" . Database :: escape_string($answerId) . "', '" . Database :: escape_string($studentChoice) . "', '" . Database :: escape_string($_SESSION['exerciseResultCoordinates'][$questionId][$answerId]) . "')"; + + $result = api_sql_query($sql, __FILE__, __LINE__); + break; + // for hotspot with fixed order + case HOT_SPOT_ORDER : + $studentChoice = $choice['order'][$answerId]; + + if ($studentChoice == $answerId) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + $studentChoice = true; + } else { + $studentChoice = false; + } + break; } // end switch Answertype } // end for that loops over all answers of the current question - + // destruction of Answer - unset($objAnswerTmp); - + unset ($objAnswerTmp); + $i++; - - $totalWeighting+=$questionWeighting; + + $totalWeighting += $questionWeighting; //added by priya saini if ($_configuration['tracking_enabled']) { - if (empty($choice)) { + if (empty ($choice)) { $choice = 0; } - if ($answerType==MULTIPLE_ANSWER ) { + if ($answerType == MULTIPLE_ANSWER) { if ($choice != 0) { $reply = array_keys($choice); - - for ($i=0;$i([0-9a-z ]*)#', $val, $arr1)) { + if (preg_match_all('#([0-9a-z ]*)#', $val, $arr1)) { $val = $arr1[1][0]; } - $val=addslashes($val); - $val=strip_tags($val); - $sql = "select position from $table_ans where question_id='".Database::escape_string($questionId)."' and answer='".Database::escape_string($val)."' AND correct=0"; + $val = addslashes($val); + $val = strip_tags($val); + $sql = "select position from $table_ans where question_id='" . Database :: escape_string($questionId) . "' and answer='" . Database :: escape_string($val) . "' AND correct=0"; $res = api_sql_query($sql, __FILE__, __LINE__); - if (Database::num_rows($res)>0) { - $answer = Database::result($res,0,"position"); + if (Database :: num_rows($res) > 0) { + $answer = Database :: result($res, 0, "position"); } else { $answer = ''; } - exercise_attempt($questionScore,$answer,$quesId,$exeId,$j); - + exercise_attempt($questionScore, $answer, $quesId, $exeId, $j); + } - } elseif ($answerType==FREE_ANSWER) { + } + elseif ($answerType == FREE_ANSWER) { $answer = $choice; - exercise_attempt($questionScore,$answer,$quesId,$exeId,0); - } elseif ($answerType==UNIQUE_ANSWER) { - $sql = "select id from $table_ans where question_id='".Database::escape_string($questionId)."' and position='".Database::escape_string($choice)."'"; + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); + } + elseif ($answerType == UNIQUE_ANSWER) { + $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__); - $answer = Database::result($res,0,"id"); - exercise_attempt($questionScore,$answer,$quesId,$exeId,0); + $answer = Database :: result($res, 0, "id"); + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); } else { - exercise_attempt($questionScore,$answer,$quesId,$exeId,0); + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); } } } // end huge foreach() block that loops over all questions - - //at loops over all questions - $sql_update = 'UPDATE '.$stat_table.' SET exe_result = exe_result + '.(int)$totalScore.',exe_weighting = exe_weighting + '.(int)$totalWeighting.' WHERE exe_id = '.$exe_id; - api_sql_query($sql_update ,__FILE__,__LINE__); - //END of saving and qualifying - //------------------------------------------------------------------------------------------ - // - } - - if (isset($_POST['hotspot'])) { - $exerciseResultCoordinates[$key] = $_POST['hotspot'][$key]; - } - } - } - if ($debug>0) { - echo str_repeat(' ',0).'$choice is an array - end'."
\n"; - } - } - - // the script "exercise_result.php" will take the variable $exerciseResult from the session - api_session_register('exerciseResult'); - api_session_register('exerciseResultCoordinates'); - - // if it is the last question (only for a sequential exercise) - if($exerciseType == 1 || $questionNum >= $nbrQuestions) { - if ($debug>0) { - echo str_repeat(' ',0).'Redirecting to exercise_result.php - Remove debug option to let this happen'."
\n"; - } - // goes to the script that will show the result of the exercise - if ($exerciseType == 1) { - header("Location: exercise_result.php?exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); - } else { - if ($exe_id!='') { - //clean incomplete - $update_query = 'UPDATE '.$stat_table.' SET '."status = '', data_tracking='', exe_date = '".date('Y-m-d H:i:s')."'".' WHERE exe_id = '.$exe_id; - api_sql_query($update_query,__FILE__,__LINE__); - } - header("Location: exercise_show.php?id=$exeId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); - } - exit(); - } - if ($debug>0) { - echo str_repeat(' ',0).'$formSent was set - end'."
\n"; - } + + //at loops over all questions + $sql_update = 'UPDATE ' . $stat_table . ' SET exe_result = exe_result + ' . (int) $totalScore . ',exe_weighting = exe_weighting + ' . (int) $totalWeighting . ' WHERE exe_id = ' . $exe_id; + api_sql_query($sql_update, __FILE__, __LINE__); + //END of saving and qualifying + //------------------------------------------------------------------------------------------ + // + } + + if (isset ($_POST['hotspot'])) { + $exerciseResultCoordinates[$key] = $_POST['hotspot'][$key]; + } + } + } + if ($debug > 0) { + echo str_repeat(' ', 0) . '$choice is an array - end' . "
\n"; + } + } + + // the script "exercise_result.php" will take the variable $exerciseResult from the session + api_session_register('exerciseResult'); + api_session_register('exerciseResultCoordinates'); + + // if it is the last question (only for a sequential exercise) + if ($exerciseType == 1 || $questionNum >= $nbrQuestions) { + if ($debug > 0) { + echo str_repeat(' ', 0) . 'Redirecting to exercise_result.php - Remove debug option to let this happen' . "
\n"; + } + // goes to the script that will show the result of the exercise + if ($exerciseType == 1) { + header("Location: exercise_result.php?exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); + } else { + if ($exe_id != '') { + //clean incomplete + $update_query = 'UPDATE ' . $stat_table . ' SET ' . "status = '', data_tracking='', exe_date = '" . date('Y-m-d H:i:s') . "'" . ' WHERE exe_id = ' . $exe_id; + api_sql_query($update_query, __FILE__, __LINE__); + } + header("Location: exercise_show.php?id=$exeId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); + } + exit (); + } + if ($debug > 0) { + echo str_repeat(' ', 0) . '$formSent was set - end' . "
\n"; + } } // if the object is not in the session //why destroying the exercise when a LP is loaded ? //if (!isset($_SESSION['objExercise']) || $origin == 'learnpath' || $_SESSION['objExercise']->id != $_REQUEST['exerciseId']) { -if (!isset($_SESSION['objExercise']) || $_SESSION['objExercise']->id != $_REQUEST['exerciseId']) { - if ($debug>0) { - echo str_repeat(' ',0).'$_SESSION[objExercise] was unset'."
\n"; - } - // construction of Exercise - $objExercise=new Exercise(); - unset($_SESSION['questionList']); - - // if the specified exercise doesn't exist or is disabled - if (!$objExercise->read($exerciseId) || (!$objExercise->selectStatus() && !$is_allowedToEdit && ($origin != 'learnpath') )) { - unset($objExercise); - $error = get_lang('ExerciseNotFound'); - //die(get_lang('ExerciseNotFound')); - } else { - // saves the object into the session - api_session_register('objExercise'); - if ($debug>0) { - echo str_repeat(' ',0).'$_SESSION[objExercise] was unset - set now - end'."
\n"; - } - } +if (!isset ($_SESSION['objExercise']) || $_SESSION['objExercise']->id != $_REQUEST['exerciseId']) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[objExercise] was unset' . "
\n"; + } + // construction of Exercise + $objExercise = new Exercise(); + unset ($_SESSION['questionList']); + + // if the specified exercise doesn't exist or is disabled + if (!$objExercise->read($exerciseId) || (!$objExercise->selectStatus() && !$is_allowedToEdit && ($origin != 'learnpath'))) { + unset ($objExercise); + $error = get_lang('ExerciseNotFound'); + //die(get_lang('ExerciseNotFound')); + } else { + // saves the object into the session + api_session_register('objExercise'); + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[objExercise] was unset - set now - end' . "
\n"; + } + } } -if (!isset($objExcercise) && isset($_SESSION['objExercise'])) { - $objExercise = $_SESSION['objExercise']; +if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { + $objExercise = $_SESSION['objExercise']; } if (!is_object($objExercise)) { header('Location: exercice.php'); - exit(); + exit (); } $Exe_starttime = $objExercise->start_time; $Exe_endtime = $objExercise->end_time; $quizID = $objExercise->selectId(); -$exerciseAttempts=$objExercise->selectAttempts(); -$exerciseTitle=$objExercise->selectTitle(); -$exerciseDescription=$objExercise->selectDescription(); -$exerciseDescription=stripslashes($exerciseDescription); -$exerciseSound=$objExercise->selectSound(); -$randomQuestions=$objExercise->isRandom(); -$exerciseType=$objExercise->selectType(); -$table_quiz_test= Database :: get_course_table(TABLE_QUIZ_TEST); +$exerciseAttempts = $objExercise->selectAttempts(); +$exerciseTitle = $objExercise->selectTitle(); +$exerciseDescription = $objExercise->selectDescription(); +$exerciseDescription = stripslashes($exerciseDescription); +$exerciseSound = $objExercise->selectSound(); +$randomQuestions = $objExercise->isRandom(); +$exerciseType = $objExercise->selectType(); +$table_quiz_test = Database :: get_course_table(TABLE_QUIZ_TEST); //if (!isset($_SESSION['questionList']) || $origin == 'learnpath') { //in LP's is enabled the "remember question" feature? -$my_exe_id=Security::remove_XSS($_GET['exerciseId']); -if (!isset($_SESSION['questionList'])) { - if ($debug>0){echo str_repeat(' ',0).'$_SESSION[questionList] was unset'."
\n";} - // selects the list of question ID - $my_question_list=array(); - $questionList = ($randomQuestions?$objExercise->selectRandomList():$objExercise->selectQuestionList()); - // saves the question list into the session - $sql='SELECT random FROM '.$table_quiz_test.' WHERE id="'.Database::escape_string($my_exe_id).'";'; - $rs=api_sql_query($sql,__FILE__,__LINE__); - $row_number=Database::fetch_array($rs); - $z=0; - - if ($row_number['random']<>0) { - foreach ($questionList as $infoquestionList) { - if ($z<$row_number['random']) { - $my_question_list[$z]=$infoquestionList; - } else { - break; - } +$my_exe_id = Security :: remove_XSS($_GET['exerciseId']); +if (!isset ($_SESSION['questionList'])) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset' . "
\n"; + } + // selects the list of question ID + $my_question_list = array (); + $questionList = ($randomQuestions ? $objExercise->selectRandomList() : $objExercise->selectQuestionList()); + // saves the question list into the session + $sql = 'SELECT random FROM ' . $table_quiz_test . ' WHERE id="' . Database :: escape_string($my_exe_id) . '";'; + $rs = api_sql_query($sql, __FILE__, __LINE__); + $row_number = Database :: fetch_array($rs); + $z = 0; + + if ($row_number['random'] <> 0) { + foreach ($questionList as $infoquestionList) { + if ($z < $row_number['random']) { + $my_question_list[$z] = $infoquestionList; + } else { + break; + } $z++; - } - // $questionList=array(); - $questionList=$my_question_list; - } - api_session_register('questionList'); - if ($debug>0){echo str_repeat(' ',0).'$_SESSION[questionList] was unset - set now - end'."
\n";} + } + // $questionList=array(); + $questionList = $my_question_list; + } + api_session_register('questionList'); + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset - set now - end' . "
\n"; + } } -if(!isset($objExcercise) && isset($_SESSION['objExercise'])) { +if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { $questionList = $_SESSION['questionList']; } $quizStartTime = time(); api_session_register('quizStartTime'); -$nbrQuestions=sizeof($questionList); +$nbrQuestions = sizeof($questionList); // if questionNum comes from POST and not from GET -if(!$questionNum || $_POST['questionNum']) { - // only used for sequential exercises (see $exerciseType) - if(!$questionNum) { - $questionNum=1; - } else { - $questionNum++; - } +if (!$questionNum || $_POST['questionNum']) { + // only used for sequential exercises (see $exerciseType) + if (!$questionNum) { + $questionNum = 1; + } else { + $questionNum++; + } } -if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) { - $_SESSION['gradebook']=Security::remove_XSS($_GET['gradebook']); - $gradebook= $_SESSION['gradebook']; -} elseif (empty($_GET['gradebook'])) { - unset($_SESSION['gradebook']); - $gradebook= ''; -} +if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { + $_SESSION['gradebook'] = Security :: remove_XSS($_GET['gradebook']); + $gradebook = $_SESSION['gradebook']; +} +elseif (empty ($_GET['gradebook'])) { + unset ($_SESSION['gradebook']); + $gradebook = ''; +} -if (!empty($gradebook) && $gradebook=='view') { +if (!empty ($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array ( 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook') @@ -718,144 +745,145 @@ if (!empty($gradebook) && $gradebook=='view') { } //$nameTools=get_lang('Exercice'); -$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); -$interbreadcrumb[]=array("url" => "#","name" => $exerciseTitle); +$interbreadcrumb[] = array ( + "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 -$htmlHeadXtra[] = " - - - - - + + + "; - Display::display_header($nameTools,"Exercise"); -} -else -{ - if(empty($charset)) - { + // --> + "; + Display :: display_header($nameTools, "Exercise"); +} else { + if (empty ($charset)) { $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); - if(empty($document_language)) - { - //if there was no valid iso-code, use the english one - $document_language = 'en'; + @ $document_language = Database :: get_language_isocode($language_interface); + if (empty ($document_language)) { + //if there was no valid iso-code, use the english one + $document_language = 'en'; } /* * HTML HEADER */ - ?> " /> '; - echo Display::return_icon('quiz.gif', get_lang('GoBackToEx')).''.get_lang('GoBackToEx').''; - echo Display::return_icon('edit.gif', get_lang('ModifyExercise')).''.get_lang('ModifyExercise').''; + echo Display :: return_icon('quiz.gif', get_lang('GoBackToEx')) . '' . get_lang('GoBackToEx') . ''; + echo Display :: return_icon('edit.gif', get_lang('ModifyExercise')) . '' . get_lang('ModifyExercise') . ''; echo ''; } -$exerciseTitle=api_parse_tex($exerciseTitle); +$exerciseTitle = api_parse_tex($exerciseTitle); -echo "

".$exerciseTitle."

"; +echo "

" . $exerciseTitle . "

"; -if( $exerciseAttempts > 0){ +if ($exerciseAttempts > 0) { $user_id = api_get_user_id(); $course_code = api_get_course_id(); - $sql = "SELECT count(*) FROM $stat_table WHERE exe_exo_id = '$quizID' - AND exe_user_id = '$user_id' - AND status != 'incomplete' - AND orig_lp_id = $safe_lp_id - AND orig_lp_item_id = $safe_lp_item_id - AND exe_cours_id = '$course_code' AND session_id = '".(int)$_SESSION['id_session']."'"; - - $aquery = api_sql_query($sql, __FILE__, __LINE__); - $attempt = Database::fetch_array($aquery); - - if ( $attempt[0] >= $exerciseAttempts ) { - if (!api_is_allowed_to_edit()) { - Display::display_warning_message(sprintf(get_lang('ReachedMaxAttempts'),$exerciseTitle,$exerciseAttempts),false); - if ($origin != 'learnpath') - Display::display_footer(); - exit; - } else { - Display::display_warning_message(sprintf(get_lang('ReachedMaxAttemptsAdmin'),$exerciseTitle,$exerciseAttempts),false); + $sql = "SELECT count(*) FROM $stat_table WHERE exe_exo_id = '$quizID' + AND exe_user_id = '$user_id' + AND status != 'incomplete' + AND orig_lp_id = $safe_lp_id + AND orig_lp_item_id = $safe_lp_item_id + AND exe_cours_id = '$course_code' AND session_id = '" . (int) $_SESSION['id_session'] . "'"; + + $aquery = api_sql_query($sql, __FILE__, __LINE__); + $attempt = Database :: fetch_array($aquery); + + if ($attempt[0] >= $exerciseAttempts) { + if (!api_is_allowed_to_edit()) { + Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $exerciseTitle, $exerciseAttempts), false); + if ($origin != 'learnpath') + Display :: display_footer(); + exit; + } else { + Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttemptsAdmin'), $exerciseTitle, $exerciseAttempts), false); } } } if (!function_exists('convert_date_to_number')) { - function convert_date_to_number($default){ + function convert_date_to_number($default) { // 2008-10-12 00:00:00 ---to--> 12345672218 (timestamp) - $parts = split(' ',$default); - list($d_year,$d_month,$d_day) = split('-',$parts[0]); - list($d_hour,$d_minute,$d_second) = split(':',$parts[1]); + $parts = split(' ', $default); + list ($d_year, $d_month, $d_day) = split('-', $parts[0]); + list ($d_hour, $d_minute, $d_second) = split(':', $parts[1]); return mktime($d_hour, $d_minute, $d_second, $d_month, $d_day, $d_year); } } -$limit_time_exists = (($Exe_starttime!='0000-00-00 00:00:00')||($Exe_endtime!='0000-00-00 00:00:00'))? true : false; -if($limit_time_exists){ +$limit_time_exists = (($Exe_starttime != '0000-00-00 00:00:00') || ($Exe_endtime != '0000-00-00 00:00:00')) ? true : false; +if ($limit_time_exists) { $exercise_start_time = convert_date_to_number($Exe_starttime); $exercise_end_time = convert_date_to_number($Exe_endtime); $time_now = convert_date_to_number(date('Y-m-d H:i:s')); - $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($permission_to_start == false || $exercise_timeover == true ){ // - if(!api_is_allowed_to_edit()){ - $message_warning = ($permission_to_start == false)? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit') ; - Display::display_warning_message(sprintf($message_warning,$exerciseTitle,$exerciseAttempts)); - Display::display_footer(); - exit; - } else { - $message_warning = ($permission_to_start == false)? get_lang('ExerciseNoStartedAdmin') : get_lang('ReachedTimeLimitAdmin') ; - Display::display_warning_message(sprintf($message_warning,$exerciseTitle,$exerciseAttempts)); + $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 ($permission_to_start == false || $exercise_timeover == true) { // + if (!api_is_allowed_to_edit()) { + $message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit'); + Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts)); + Display :: display_footer(); + exit; + } else { + $message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedAdmin') : get_lang('ReachedTimeLimitAdmin'); + Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts)); } } } -if(!empty($error)) -{ - Display::display_error_message($error,false); -} -else -{ - if(!empty($exerciseSound)) { - echo "", - ",get_lang('Sound')."; +if (!empty ($error)) { + Display :: display_error_message($error, false); +} else { + if (!empty ($exerciseSound)) { + echo "", ", get_lang('Sound') .
+		"; } // Get number of hotspot questions for javascript validation $number_of_hotspot_questions = 0; $onsubmit = ''; - $i=0; + $i = 0; //i have a doubt in this line cvargas //var_dump($questionList); - if (!strcmp($questionList[0],'')===0) { - foreach($questionList as $questionId) { + if (!strcmp($questionList[0], '') === 0) { + foreach ($questionList as $questionId) { $i++; $objQuestionTmp = Question :: read($questionId); // for sequential exercises - if($exerciseType == 2) { + if ($exerciseType == 2) { // if it is not the right question, goes to the next loop iteration - if($questionNum != $i) { + if ($questionNum != $i) { continue; - } - else - { - if ($objQuestionTmp->selectType() == HOT_SPOT) - { + } else { + if ($objQuestionTmp->selectType() == HOT_SPOT) { $number_of_hotspot_questions++; } - + break; } - } - else - { - if ($objQuestionTmp->selectType() == HOT_SPOT) - { + } else { + if ($objQuestionTmp->selectType() == HOT_SPOT) { $number_of_hotspot_questions++; } } } } - if($number_of_hotspot_questions > 0) - { - $onsubmit = "onsubmit=\"return validateFlashVar('".$number_of_hotspot_questions."', '".get_lang('HotspotValidateError1')."', '".get_lang('HotspotValidateError2')."');\""; + if ($number_of_hotspot_questions > 0) { + $onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\""; } - $s="

$exerciseDescription

"; + $s = "

$exerciseDescription

"; - if($exerciseType==2){ - $s2 = "&exerciseId=".$exerciseId; + if ($exerciseType == 2) { + $s2 = "&exerciseId=" . $exerciseId; } - - $s.="
- - - - - - - - - - - + +
- "; - echo $s; - $i=1; - foreach($questionList as $questionId) { - // for sequential exercises - if($exerciseType == 2) { - // if it is not the right question, goes to the next loop iteration - if ($questionNum != $i ) { - $i++; - continue; - } else { - if ($exerciseFeedbackType != 1) { - // if the user has already answered this question - if (isset($exerciseResult[$questionId])) { - // construction of the Question object - $objQuestionTmp = Question::read($questionId); - $questionName=$objQuestionTmp->selectTitle(); - // destruction of the Question object - unset($objQuestionTmp); - Display::display_normal_message(get_lang('AlreadyAnswered')); - $i++; - //echo ''; - break; - } - } - } - } - // shows the question and its answers - showQuestion($questionId, false, $origin,$i,$nbrQuestions); - $i++; - // for sequential exercises - if($exerciseType == 2) { - // quits the loop + + $s .= " + + + + + + + + +
'.get_lang('AlreadyAnswered').' "'.$questionName.'"
+ + - -
+ "; + echo $s; + $i = 1; + foreach ($questionList as $questionId) { + // for sequential exercises + if ($exerciseType == 2) { + // if it is not the right question, goes to the next loop iteration + if ($questionNum != $i) { + $i++; + continue; + } else { + if ($exerciseFeedbackType != 1) { + // if the user has already answered this question + if (isset ($exerciseResult[$questionId])) { + // construction of the Question object + $objQuestionTmp = Question :: read($questionId); + $questionName = $objQuestionTmp->selectTitle(); + // destruction of the Question object + unset ($objQuestionTmp); + Display :: display_normal_message(get_lang('AlreadyAnswered')); + $i++; + //echo ''; break; - } + } } - // end foreach() + } + } + // shows the question and its answers + showQuestion($questionId, false, $origin, $i, $nbrQuestions); + $i++; + // for sequential exercises + if ($exerciseType == 2) { + // quits the loop + break; + } + } + // end foreach() echo " -
"; - $submit_btn=""; - } - - echo $submit_btn; + $submit_btn .= get_lang('NextQuestion'); + } + $submit_btn .= ""; + } + + echo $submit_btn; echo "
'.get_lang('AlreadyAnswered').' "'.$questionName.'"
-
"; - $b=2; +
"; + $b = 2; } - if($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType!=1) { - //if($questionNum < 2){ - if($table_recorded_not_exist){ - if($exerciseType == 2){ +if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType != 1) { + //if($questionNum < 2){ + if ($table_recorded_not_exist) { + if ($exerciseType == 2) { api_sql_query("INSERT INTO $stat_table(exe_exo_id,exe_user_id,exe_cours_id,status,session_id,data_tracking,start_date,orig_lp_id,orig_lp_item_id) - VALUES('$exerciseId','".api_get_user_id()."','".$_course['id']."','incomplete','".api_get_session_id()."','".implode(',',$questionList)."','".date('Y-m-d H:i:s')."',$safe_lp_id,$safe_lp_item_id)",__FILE__,__LINE__); - } else { - api_sql_query("INSERT INTO $stat_table (exe_exo_id,exe_user_id,exe_cours_id,status,session_id,start_date,orig_lp_id,orig_lp_item_id) - VALUES('$exerciseId','".api_get_user_id()."','".$_course['id']."','incomplete','".api_get_session_id()."','".date('Y-m-d H:i:s')."',$safe_lp_id,$safe_lp_item_id)",__FILE__,__LINE__); - } + VALUES('$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . implode(',', $questionList) . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)", __FILE__, __LINE__); + } else { + api_sql_query("INSERT INTO $stat_table (exe_exo_id,exe_user_id,exe_cours_id,status,session_id,start_date,orig_lp_id,orig_lp_item_id) + VALUES('$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)", __FILE__, __LINE__); } - } + } +} -if ($origin != 'learnpath') { +if ($origin != 'learnpath') { //so we are not in learnpath tool - Display::display_footer(); -} + Display :: display_footer(); +} \ No newline at end of file diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 55b5610149..753f4024ea 100644 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -29,7 +29,7 @@ * @author Olivier Brouckaert, main author * @author Roan Embrechts, some refactoring * @author Julio Montoya Armas switchable fill in blank option added -* @version $Id: exercise_result.php 20089 2009-04-24 21:12:54Z cvargas1 $ +* @version $Id: exercise_result.php 20231 2009-04-30 18:08:12Z cvargas1 $ * * @todo split more code up in functions, move functions to library? */ @@ -172,7 +172,7 @@ if (!empty($gradebook) && $gradebook=='view') { $nameTools=get_lang('Exercice'); -$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')); +$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); $htmlHeadXtra[] = " '; + echo 'window.location.href = "exercise_submit_modal.php?hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&questionnum='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'gradebook='.$gradebook.'";'; } $choice=array(); diff --git a/main/exercice/export/exercise_import.inc.php b/main/exercice/export/exercise_import.inc.php index 67d1a8985e..8d272e3c00 100755 --- a/main/exercice/export/exercise_import.inc.php +++ b/main/exercice/export/exercise_import.inc.php @@ -279,7 +279,7 @@ function import_exercise($file) array_push ($backlog_message, 'QUESTION DATA INVALID !!!'); } } - $link = "
".get_lang('See the exercise')."
"; + $link = "
".get_lang('See the exercise')."
"; array_push ($backlog_message, $link); //delete the temp dir where the exercise was unzipped diff --git a/main/gradebook/lib/be/studentpublicationlink.class.php b/main/gradebook/lib/be/studentpublicationlink.class.php index d7423a5e09..e04d570e01 100644 --- a/main/gradebook/lib/be/studentpublicationlink.class.php +++ b/main/gradebook/lib/be/studentpublicationlink.class.php @@ -258,7 +258,7 @@ class StudentPublicationLink extends AbstractLink .'main/work/work.php?cidReq='.$this->get_course_code().'&gradebook=view&curdirpath='.substr($this->exercise_data['url'], 1); if (!api_is_allowed_to_create_course() && $this->calc_score(api_get_user_id()) == null) { - $url .= '&curdirpath=/'.$this->get_ref_id(); + //$url .= '&curdirpath=/'.$this->get_ref_id(); } return $url; }