diff --git a/main/exercice/addlimits.php b/main/exercice/addlimits.php index eca3f1076b..c9a1114fe6 100755 --- a/main/exercice/addlimits.php +++ b/main/exercice/addlimits.php @@ -46,11 +46,11 @@ api_protect_course_script(); Table definitions @todo: use the Database :: get_course_table functions */ -$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); -$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); -$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); -$TBL_REPONSES = Database::get_course_table('quiz_answer'); -$main_user_table = Database :: get_main_table(TABLE_MAIN_USER); +$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); +$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); +$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); +$TBL_REPONSES = Database::get_course_table('quiz_answer'); +$main_user_table = Database :: get_main_table(TABLE_MAIN_USER); $main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); @@ -123,13 +123,10 @@ $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices') Display::display_header($nameTools,"Exercise"); /* ------------------------------------------------------------ Action handling ------------------------------------------------------------ */ -include('../inc/global.inc.php'); -if (isset($_POST['ok'])) -{ +require_once '../inc/global.inc.php'; +if (isset($_POST['ok'])) { $message = get_lang('TestLimitsAdded'); Display::display_normal_message($message); } diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 44febe2e99..8e5c80ec37 100755 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -38,9 +38,7 @@ require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php'; require_once api_get_path(LIBRARY_PATH) . 'usermanager.lib.php'; /* ------------------------------------------------------------ Constants and variables ------------------------------------------------------------ */ $is_allowedToEdit = api_is_allowed_to_edit(null,true); $is_tutor = api_is_allowed_to_edit(true); @@ -130,7 +128,7 @@ if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !emp } if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_GET['exeid']== strval(intval($_GET['exeid']))) { - $id = $_GET['exeid']; //filtered by post-condition + $id = intval($_GET['exeid']); //filtered by post-condition $emailid = $_GET['emailid']; $test = $_GET['test']; $from = $_SESSION['_user']['mail']; @@ -181,16 +179,15 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit Database::query($query); - $qry = 'SELECT sum(marks) as tot - FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.intval($id).' + FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$id.' GROUP BY question_id'; $res = Database::query($qry); $tot = Database::result($res,0,'tot'); //updating also the total weight $totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".Database::escape_string($tot)."', exe_weighting = '".Database::escape_string($total_weighting)."' - WHERE exe_Id='".Database::escape_string($id)."'"; + WHERE exe_Id='".$id."'"; Database::query($totquery); $recording_changes = 'INSERT INTO '.$TBL_RECORDING.' ' . '(exe_id, @@ -341,10 +338,8 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit //mail($emailid, $subject, $mess,$headers); @api_mail_html($emailid, $emailid, $subject, $mess, $from_name, $from); - if (in_array($origin, array ( - 'tracking_course', - 'user_course' - ))) { + if (in_array($origin, array ('tracking_course','user_course'))) { + if (isset ($_POST['lp_item_id']) && isset ($_POST['lp_item_view_id']) && isset ($_POST['student_id']) && isset ($_POST['total_score']) && isset ($_POST['total_time']) && isset ($_POST['totalWeighting'])) { $lp_item_id = $_POST['lp_item_id']; $lp_item_view_id = $_POST['lp_item_view_id']; @@ -362,10 +357,10 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit //$my_real_lp_item_view_id = Database :: escape_string($_POST['real_lp_item_view_id']); - $lp_item_id = Database :: escape_string($lp_item_id); + $lp_item_id = Database :: escape_string($lp_item_id); $lp_item_view_id = Database :: escape_string($lp_item_view_id); - $student_id = Database :: escape_string($student_id); - $totalWeighting = Database :: escape_string($totalWeighting); + $student_id = Database :: escape_string($student_id); + $totalWeighting = Database :: escape_string($totalWeighting); /* $sql = "SELECT (view_count) FROM $TBL_LP_ITEM_VIEW @@ -984,13 +979,12 @@ if ($show == 'test') { <?php echo api_htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?> '; echo ""; - echo "\n"; + echo ""; } else { // student only ?> @@ -1043,10 +1037,7 @@ if ($show == 'test') { } else { echo get_lang('CantShowResults'); } -?> - - '; } // skips the last exercise, that is only used to know if we have or not to create a link "Next page" if ($i == $limitExPage) { @@ -1105,7 +1096,6 @@ if ($show == 'test') { } // prof only if ($is_allowedToEdit) { - /************/ ?> @@ -1151,9 +1141,6 @@ if ($show == 'test') { } } -?> - - -'; } -/*****************************************/ /* Exercise Results (uses tracking tool) */ -/*****************************************/ // if tracking is enabled if ($_configuration['tracking_enabled'] && ($show == 'result')) { diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 3b166173cb..f09f112ce8 100755 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -1,13 +1,11 @@
: