diff --git a/main/extra/create_exam.php b/main/extra/create_exam.php index 17cb530846..a0e08a45d1 100644 --- a/main/extra/create_exam.php +++ b/main/extra/create_exam.php @@ -9,14 +9,15 @@ if (empty($allow)) { } $tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); -$ex_user_id = isset($_GET['ex_user_id']) ? $_GET['ex_user_id'] : ""; -$mod_no = isset($_GET['mod_no']) ? $_GET['mod_no'] : ""; -$score_ex = isset($_GET['score_ex']) ? $_GET['score_ex'] : ""; -$score_rep1 = isset($_GET['score_rep1']) ? $_GET['score_rep1'] : ""; -$score_rep2 = isset($_GET['score_rep2']) ? $_GET['score_rep2'] : ""; -$coment = isset($_GET['coment']) ? $_GET['coment'] : ""; +$ex_user_id = isset($_GET['ex_user_id']) ? (int) $_GET['ex_user_id'] : ''; +$mod_no = isset($_GET['mod_no']) ? Database::escape_string($_GET['mod_no']) : ''; +$score_ex = isset($_GET['score_ex']) ? Database::escape_string($_GET['score_ex']) : ''; +$score_rep1 = isset($_GET['score_rep1']) ? Database::escape_string($_GET['score_rep1']) : ''; +$score_rep2 = isset($_GET['score_rep2']) ? Database::escape_string($_GET['score_rep2']) : ''; +$coment = isset($_GET['coment']) ? Database::escape_string($_GET['coment']) : ''; + $sql = "INSERT INTO $tbl_stats_exercices "."(exe_user_id,c_id,mod_no,score_ex,score_rep1,score_rep2,coment) ". "VALUES "."('$ex_user_id','0','$mod_no','$score_ex', '$score_rep1', '$score_rep2', '$coment' )"; Database::query($sql); -header("location:../extra/myStudents.php?student=$ex_user_id"); +header("location: myStudents.php?student=$ex_user_id"); exit; \ No newline at end of file diff --git a/main/extra/create_intervention.php b/main/extra/create_intervention.php index 0e709bd234..3f7a17429d 100644 --- a/main/extra/create_intervention.php +++ b/main/extra/create_intervention.php @@ -8,15 +8,14 @@ if (empty($allow)) { exit; } -$tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); +$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); +$comment = isset($_POST['inter_coment']) ? Database::escape_string($_POST['inter_coment']) : ''; +$date = isset($_POST['date']) ? Database::escape_string($_POST['date']) : ''; +$level = isset($_POST['level']) ? Database::escape_string($_POST['level']) : ''; +$ex_user_id = isset($_POST['ex_user_id']) ? Database::escape_string($_POST['ex_user_id']) : ''; -foreach ($_POST as $index => $valeur) { - $$index = Database::escape_string(trim($valeur)); -} - -$sql4 = "INSERT INTO $tbl_stats_exercices "."(exe_user_id,c_id,level,exe_date,inter_coment) ". - "VALUES "."('$ex_user_id','0','$level','$date', '$inter_coment' )"; -Database::query($sql4); - -header("location:../extra/myStudents.php?student=$ex_user_id"); +$sql = "INSERT INTO $table "."(exe_user_id,c_id,level,exe_date,inter_coment) + VALUES "."('$ex_user_id','0','$level','$date', '$comment')"; +Database::query($sql); +header("location: myStudents.php?student=$ex_user_id"); exit; diff --git a/main/extra/database.php b/main/extra/database.php index f005592a60..1b2624c8e0 100644 --- a/main/extra/database.php +++ b/main/extra/database.php @@ -7,8 +7,6 @@ require_once '../inc/global.inc.php'; exit; - - $sql = "ALTER TABLE track_e_exercises ADD COLUMN coment VARCHAR(255);"; Database::query($sql); @@ -33,7 +31,6 @@ Database::query($sql); $sql = "ALTER TABLE track_e_exercises ADD COLUMN level VARCHAR(255);"; Database::query($sql); - $sql = "CREATE TABLE IF NOT EXISTS set_module ( `id` int(4) NOT NULL AUTO_INCREMENT, `cours` varchar(40) NOT NULL, @@ -47,7 +44,6 @@ $sql = "CREATE TABLE IF NOT EXISTS set_module ( Database::query($sql); - /*$sql = "CREATE TABLE IF NOT EXISTS `kezprerequisites` ( `c_id` int(11) NOT NULL, `lp_id` int(11) NOT NULL, @@ -57,7 +53,6 @@ Database::query($sql); PRIMARY KEY (`c_id`,`lp_id`,`id`) )";*/ - $sql = "CREATE TABLE IF NOT EXISTS `c_cal_dates` ( `c_id` int(11) NOT NULL, `date` date NOT NULL, @@ -70,7 +65,6 @@ $sql = "CREATE TABLE IF NOT EXISTS `c_cal_dates` ( Database::query($sql); - $sql = "CREATE TABLE IF NOT EXISTS `c_cal_horaire` ( `id` int(11) NOT NULL AUTO_INCREMENT, `c_id` int(11) NOT NULL, @@ -82,7 +76,6 @@ $sql = "CREATE TABLE IF NOT EXISTS `c_cal_horaire` ( UNIQUE KEY `c_id` (`c_id`,`name`), KEY `idx` (`c_id`) )"; - Database::query($sql); $sql = "CREATE TABLE IF NOT EXISTS `c_cal_set_module` ( @@ -101,5 +94,4 @@ $sql = "CREATE TABLE IF NOT EXISTS `c_cal_temp` ( `user` varchar(250) NOT NULL, KEY `idx` (`c_id`) )"; - Database::query($sql); diff --git a/main/extra/delete_exam.php b/main/extra/delete_exam.php index e2f3006361..06359f7d07 100644 --- a/main/extra/delete_exam.php +++ b/main/extra/delete_exam.php @@ -14,10 +14,10 @@ api_block_anonymous_users(); $ex_user_id = isset($_GET['student_id']) ? $_GET['student_id'] : ""; $num = isset($_GET['num']) ? (int) $_GET['num'] : 0; -$tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); -$sql = "DELETE FROM $tbl_stats_exercices WHERE exe_id ='$num'"; +$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); +$sql = "DELETE FROM $table WHERE exe_id ='$num'"; Database::query($sql); -header("location:../extra/myStudents.php?student=$ex_user_id"); +header("location: myStudents.php?student=$ex_user_id"); exit; diff --git a/main/extra/edit_exam.php b/main/extra/edit_exam.php index 79c607c993..a2d46dc074 100644 --- a/main/extra/edit_exam.php +++ b/main/extra/edit_exam.php @@ -13,65 +13,59 @@ api_block_anonymous_users(); Display::display_header(); $tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); - -$num = isset($_GET['num']) ? $_GET['num'] : ''; -$student_idd = isset($_GET['student_id']) ? $_GET['student_id'] : ''; - -foreach ($_POST as $index => $valeur) { - $$index = Database::escape_string(trim($valeur)); -} +$num = isset($_GET['num']) ? (int) $_GET['num'] : ''; +$student_idd = isset($_GET['student_id']) ? (int) $_GET['student_id'] : ''; ?>
-
- - - - - - - - - - - - + + + + + + + + + + + - - - - - "; - - ?> - - > - > + $sqlexam = "SELECT * FROM $tbl_stats_exercices WHERE exe_id = $num"; + $resultexam = Database::query($sqlexam); + while ($a_exam = Database::fetch_array($resultexam)) { + $exe_id = $a_exam['exe_id']; + $mod_no = $a_exam['mod_no']; + $score_ex = $a_exam['score_ex']; + $score_rep1 = $a_exam['score_rep1']; + $score_rep2 = $a_exam['score_rep2']; + $coment = $a_exam['coment']; + echo " + + - - + + "; + ?> -
- -
+ +
- - - -
+ + - +
+
+ > + > + + + + + + $valeur) { - $$index = Database::escape_string(trim($valeur)); -} ?>
-
- - - - - - - - -
-
- - - "; - $exe_id = $a_inter['exe_id']; - ?> - + > + > + + + + +
-
".$a_inter['level']." -
- ".$a_inter['exe_date']." -
- -
+ + + + + + + + +
+
- > - > - + - - -
+
".$a_inter['level']."
+ ".$a_inter['exe_date']."
+
+ +
+
get_values_by_handler_and_field_variable( @@ -672,7 +671,7 @@ if (!empty($student_id)) { calc_score($student_id, null, $courseCodeItem, $sId); @@ -792,6 +789,7 @@ if (!empty($student_id)) { null, $sId ); + $score = Tracking:: get_avg_student_score($user_info['user_id'], $courseCodeItem, [], $sId); $progress = empty($progress) ? '0%' : $progress.'%'; $score = empty($score) ? '0%' : $score.'%'; @@ -838,12 +836,12 @@ if (!empty($student_id)) { } } else { if ($user_info['status'] != INVITEE) { - $csv_content[] = array(); + $csv_content[] = []; $csv_content[] = array(str_replace(' ', '', $table_title)); $t_lp = Database:: get_course_table(TABLE_LP_MAIN); // csv export headers - $csv_content[] = array(); + $csv_content[] = []; $csv_content[] = array( get_lang('Learnpath'), get_lang('Time'), @@ -1019,7 +1017,6 @@ if (!empty($student_id)) { } else { $css_class = "row_odd"; } - $i++; // csv export content @@ -1033,7 +1030,6 @@ if (!empty($student_id)) { ); echo ''; - echo Display::tag('td', stripslashes($lp_name)); echo Display::tag('td', api_time_to_hms($total_time)); @@ -1044,7 +1040,6 @@ if (!empty($student_id)) { } echo Display::tag('td', $score); - if (!is_null($score_latest)) { if (is_numeric($score_latest)) { $score_latest = $score_latest.'%'; @@ -1059,8 +1054,9 @@ if (!empty($student_id)) { } echo Display::tag('td', $progress); - //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table - //which implies several other changes not a priority right now + // Do not change with api_convert_and_format_date, because + // this value came from the lp_item_view table + // which implies several other changes not a priority right now echo Display::tag('td', $start_time); if ($any_result === true) { @@ -1124,8 +1120,7 @@ if (!empty($student_id)) { '; $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.' - WHERE - exe_exo_id = "'.$exercise_id.'" AND - exe_user_id ="'.$student_id.'" AND - c_id = '.$courseInfo['real_id'].' AND - session_id = "'.$sessionId.'" AND - status = "" - ORDER BY exe_date DESC - LIMIT 1'; + WHERE + exe_exo_id = "'.$exercise_id.'" AND + exe_user_id ="'.$student_id.'" AND + c_id = '.$courseInfo['real_id'].' AND + session_id = "'.$sessionId.'" AND + status = "" + ORDER BY exe_date DESC + LIMIT 1'; $result_last_attempt = Database::query($sql); if (Database:: num_rows($result_last_attempt) > 0) { $id_last_attempt = Database:: result($result_last_attempt, 0, 0); if ($count_attempts > 0) { - echo ' - '.Display::return_icon('quiz.gif').' - '; + echo ''; + echo Display::return_icon('quiz.gif'); + echo ''; } } echo ''; - echo ''; $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; echo Display::url( Display::return_icon( 'test_results.png', get_lang('AllAttempts'), - array(), + [], ICON_SIZE_SMALL ), $all_attempt_url @@ -1247,16 +1241,13 @@ if (!empty($student_id)) { $data_exercices[$i][] = $exercices['title']; $data_exercices[$i][] = $score_percentage.'%'; $data_exercices[$i][] = $count_attempts; - $csv_content[] = array( $exercices['title'], $lp_name, $score_percentage, $count_attempts, ); - $i++; - } } else { echo ''.get_lang('NoExercise').''; @@ -1271,17 +1262,16 @@ if (!empty($student_id)) { // @when using sessions we do not show the survey list if (empty($sessionId)) { $survey_list = SurveyManager::get_surveys($course_code, $sessionId); - - $survey_data = array(); + $survey_data = []; foreach ($survey_list as $survey) { $user_list = SurveyManager::get_people_who_filled_survey( $survey['survey_id'], false, $courseInfo['real_id'] ); - $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL); + $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), [], ICON_SIZE_SMALL); if (in_array($student_id, $user_list)) { - $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL); + $survey_done = Display::return_icon("accept.png", get_lang('Answered'), [], ICON_SIZE_SMALL); } $data = array('title' => $survey['title'], 'done' => $survey_done); $survey_data[] = $data; @@ -1325,7 +1315,7 @@ if (!empty($student_id)) {

300) { break; - } } + $diff = $jour_agenda - $Total; if ($diff > 0) { $sing = get_lang('retard'); @@ -1587,9 +1558,7 @@ $sqlgo = "SELECT * FROM $tbl_personal_agenda WHERE user = ".$_GET['student']." AND title = '".$goto."' "; - $result7 = Database::query($sqlgo); - $res7 = Database::fetch_array($result7); $end_dates = $res7['date']; $end_date = date("Y-m-d", strtotime($end_dates)); @@ -1599,10 +1568,8 @@ If ($end_date < '2010-01-01') { } ?> - + + + + + + + + + + + + - - - - - - - - - - - - -
- '; */ - ?> -
:

+
+

+
+ :

+
+ :

+
+ :

+
-

-
- :

-
- :

-
- :

-
-

- - - - - + + + + - > @@ -1731,72 +1686,68 @@ If ($end_date < '2010-01-01') {
- - - - - - - -
@@ -1720,10 +1675,10 @@ If ($end_date < '2010-01-01') { + - " + ">
- -
-
- - - - - - - +
- - - - - -
+ + + + + + -
-
- - - - "; - $exe_id = $a_inter['exe_id']; - $student_id = $_GET['student']; - + + + + "; + $exe_id = $a_inter['exe_id']; + $student_id = $_GET['student']; + ?> + + $courses) { $session_id = $key; $session_info = api_get_session_info($session_id); @@ -1857,20 +1807,19 @@ if (empty($_GET['details'])) { } $title = ''; if (empty($session_id)) { - $title = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.get_lang( + $title = Display::return_icon('course.png', get_lang('Course'), [], ICON_SIZE_SMALL).' '.get_lang( 'Course' ); } else { $title = Display::return_icon( 'session.png', get_lang('Session'), - array(), + [], ICON_SIZE_SMALL ).' '.$session_name.($date_session ? ' ('.$date_session.')' : ''); } // Courses - echo '
+ + + + + +
".$a_inter['level']." - - $inter_date - $inter_coment +
+
".$a_inter['level']." + $inter_date + $inter_coment + + + +    + + + - - - - -    - - - -
'; echo '

'.$title.'

'; echo ' @@ -1878,99 +1827,76 @@ if (empty($_GET['details'])) { - + '; if (!empty($courses)) { foreach ($courses as $course_code) { - if (CourseManager:: is_user_subscribed_in_course($student_id, $course_code, true)) { $course_info = CourseManager:: get_course_information($course_code); - $time_spent_on_course = api_time_to_hms( Tracking:: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id) ); -//on sort le c_id avec le code du cours - $sql8 = "SELECT * - FROM course - WHERE code = '$course_code' - "; + //on sort le c_id avec le code du cours + $sql8 = "SELECT * + FROM course + WHERE code = ' $course_code' + "; $result8 = Database::query($sql8); $course_code_id = Database::fetch_array($result8); $c_id = $course_code_id ['id']; // firts connection date $sql2 = 'SELECT STR_TO_DATE(access_date,"%Y-%m-%d") - FROM '.$tbl_stats_access.' - WHERE access_user_id = '.$student_id.' - AND c_id = '.$c_id.' - ORDER BY access_id ASC LIMIT 0,1 - '; + FROM '.$tbl_stats_access.' + WHERE access_user_id = '.$student_id.' + AND c_id = '.$c_id.' + ORDER BY access_id ASC LIMIT 0,1 + '; $rs2 = Database::query($sql2); $first_connection_date_to_module = Database::result($rs2, 0, 0); - -//pour trouver la date de fin prévue du module + //pour trouver la date de fin prévue du module $end_date_module = get_lang('hors_cal'); - - -//avec le nom d'horaire= official code, on trouve la date de début de chaque module nombre de jour a faire + //avec le nom d'horaire= official code, on trouve la date de + // début de chaque module nombre de jour a faire $sql = "SELECT * FROM c_cal_dates - where horaire_name = '$nom_hor' - and c_id = '$c_id' - AND date = date_format('$first_connection_date_to_module','%Y-%m-%d') - "; - + where horaire_name = '$nom_hor' + and c_id = '$c_id' + AND date = date_format('$first_connection_date_to_module','%Y-%m-%d') + "; $res = Database::query($sql); $resulta = Database::fetch_array($res); $date_debut = $resulta['date']; - - -//on trouve le nombre de jour pour ce module - $sql = "SELECT * FROM c_cal_set_module - where c_id = '$c_id' - - "; - + //on trouve le nombre de jour pour ce module + $sql = "SELECT * FROM c_cal_set_module where c_id = '$c_id'"; $res = Database::query($sql); $resulta = Database::fetch_array($res); $nombre_heure = $resulta['minutes']; - -// on trouve le nombre de minute par jour + // on trouve le nombre de minute par jour // Julio /*$sql = "SELECT * FROM c_cal_horaire where c_id = '$course_code_real'"; $res = Database::query($sql); $resulta = Database::fetch_array($res); $nombre_minutes = $resulta['num_minute'];*/ $nombre_minutes = 0; - -//on calcule le nombre de jour par module + //on calcule le nombre de jour par module $nombre_jours_module = $nombre_heure * '60' / $nombre_minutes; -//on arrondi + //on arrondi $nombre_jours_module = number_format($nombre_jours_module, 0); - - -//on trouve la date de fin de chaque module AND date = date_format('$first_connection_date_to_module','%Y-%m-%d') - + //on trouve la date de fin de chaque module AND date = date_format('$first_connection_date_to_module','%Y-%m-%d') $sql = "SELECT * FROM `c_cal_dates` - WHERE horaire_name = '$nom_hor' - AND c_id = '$course_code_real' - AND STR_TO_DATE(date,'%Y-%m-%d') >= STR_TO_DATE('$first_connection_date_to_module','%Y-%m-%d') - ORDER BY STR_TO_DATE(date, '%Y-%m-%d') asc - - "; - + WHERE + horaire_name = '$nom_hor' AND + c_id = '$course_code_real' AND + STR_TO_DATE(date,'%Y-%m-%d') >= STR_TO_DATE('$first_connection_date_to_module','%Y-%m-%d') + ORDER BY STR_TO_DATE(date, '%Y-%m-%d') ASC "; $res = Database::query($sql); - mysql_data_seek($res, $nombre_jours_module); $row = mysql_fetch_row($res); - $end_date_module = $row[1]; - - -//fin de trouver la date de fin prévue du module - + //fin de trouver la date de fin prévue du module // get average of faults in attendances by student $results_faults_avg = $attendance->get_faults_average_by_course( $student_id, @@ -1992,7 +1918,7 @@ if (empty($_GET['details'])) { // Get evaluations by student $cats = Category::load(null, null, $course_code, null, null, $session_id); - $scoretotal = array(); + $scoretotal = []; if (isset($cats) && isset($cats[0])) { if (!empty($session_id)) { $scoretotal = $cats[0]->calc_score($student_id, $course_code, $session_id); @@ -2042,9 +1968,8 @@ if (empty($_GET['details'])) { - - '; - + + '; if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { echo ' 0) { @@ -2436,7 +2356,7 @@ if (empty($_GET['details'])) { echo ' + + +
'.get_lang('Time').' '.get_lang('Score').' '.get_lang('FirstConnexion').''.get_lang('Progress').''.get_lang('Progress').' '.get_lang('fin_mod_prevue').' '.get_lang('Details').'
'.$time_spent_on_course.' '.$score.' '.$first_connection_date_to_module.''.$progress.''.$end_date_module.''.$progress.''.$end_date_module.' 0) { ?> @@ -2147,17 +2070,16 @@ if (empty($_GET['details'])) { // firts connection date $sql2 = 'SELECT access_date - FROM '.$tbl_stats_access.' + FROM '.$tbl_stats_access.' WHERE access_user_id = '.$_GET['student'].' AND c_id = '.$c_id.' ORDER BY access_id ASC LIMIT 0,1 '; -//echo($sql2); + $rs2 = Database::query($sql2); $first_connection_date_to_module = Database::result($rs2, 0, 0); $i = 0; while ($learnpath = Database:: fetch_array($rs_lp)) { - $lp_id = intval($learnpath['id']); $lp_name = $learnpath['name']; $any_result = false; @@ -2231,7 +2153,6 @@ if (empty($_GET['details'])) { } $i++; - // csv export content $csv_content[] = array( api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset), @@ -2331,7 +2252,7 @@ if (empty($_GET['details'])) {
'; $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$session_id"; echo Display::url( - Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), + Display::return_icon('test_results.png', get_lang('AllAttempts'), [], ICON_SIZE_SMALL), $all_attempt_url ); @@ -2451,7 +2371,6 @@ if (empty($_GET['details'])) { $score_percentage, $count_attempts, ); - $i++; } @@ -2463,17 +2382,16 @@ if (empty($_GET['details'])) { //@when using sessions we do not show the survey list if (empty($session_id)) { $survey_list = SurveyManager::get_surveys($course_code, $session_id); - - $survey_data = array(); + $survey_data = []; foreach ($survey_list as $survey) { $user_list = SurveyManager::get_people_who_filled_survey( $survey['survey_id'], false, $info_course['real_id'] ); - $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL); + $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), [], ICON_SIZE_SMALL); if (in_array($student_id, $user_list)) { - $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL); + $survey_done = Display::return_icon("accept.png", get_lang('Answered'), [], ICON_SIZE_SMALL); } $data = array('title' => $survey['title'], 'done' => $survey_done); $survey_data[] = $data; @@ -2509,7 +2427,7 @@ if (empty($_GET['details'])) { // line about other tools echo ''; - $csv_content[] = array(); + $csv_content[] = []; $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $session_id); $messages = Tracking::count_student_messages($student_id, $course_code, $session_id); $links = Tracking::count_student_visited_links($student_id, $course_code, $session_id); @@ -2614,10 +2532,8 @@ if ($export_csv) { - - - - - > -
-
@@ -2625,121 +2541,108 @@ if ($export_csv) { +
-
- - - - - - - - - - - - - - - -
-
- +
- - -
- - - - - - - - - -
".$a_exam['mod_no']." -
- ".$a_exam['score_ex']." -
+ + + + + + + + + + +
+
+ + - - - - $coment + + "; + $exe_idd = $a_exam['exe_id']; + $student_id = $_GET['student']; ?> -
+ +
+ + + + + + + + + +
".$a_exam['mod_no']." +
+ ".$a_exam['score_ex']." +
+ ".$a_exam['score_rep1']." +
- ".$a_exam['score_rep1']." -
- ".$a_exam['score_rep2']." -
$coment - - "; - $exe_idd = $a_exam['exe_id']; - $student_id = $_GET['student']; - ?> - > -   - - - -    - + ".$a_exam['score_rep2']."
+ > +
  + + + +    + +
+echo ' '; // tableau pour date de fin prévue pour chaque module ?> @@ -2749,7 +2652,6 @@ href="print_myStudents.php?student='.$student_id.'&details=true&course='.$course - diff --git a/main/extra/my_progress_ind.php b/main/extra/my_progress_ind.php index b2d89b2a8d..3a6968dfd8 100644 --- a/main/extra/my_progress_ind.php +++ b/main/extra/my_progress_ind.php @@ -8,9 +8,11 @@ if (empty($allow)) { exit; } +api_block_anonymous_users(); + $nameTools = get_lang('MyProgress'); $this_section = 'session_my_progress_ind'; -api_block_anonymous_users(); +$_user = api_get_user_info(); $tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $tbl_stats_access = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); @@ -24,8 +26,7 @@ $result = Database::query( $_user['user_id']." ORDER BY date_start, date_end, name"); $Sessions = Database::store_result($result); - -$Courses = array(); +$Courses = []; foreach ($Sessions as $enreg) { $id_session_temp = $enreg['id']; @@ -47,14 +48,11 @@ foreach ($Sessions as $enreg) { WHERE $tbl_session_course.c_id=$c_id AND $tbl_session_course.id_session='$id_session_temp' ORDER BY title"; - $result = Database::query($sql); - while ($a_session_courses = Database::fetch_array($result)) { $a_session_courses['id_session'] = $id_session_temp; $Courses[$a_session_courses['code']] = $a_session_courses; } - } // affichage des jours complétés dans les parcours l'élève @@ -64,33 +62,25 @@ $sql2 = "SELECT c_id, user_id FROM course_rel_user WHERE user_id = '$user_c_id' "; - $result2 = Database::query($sql2); $Total = 0; while ($a_courses = Database::fetch_array($result2)) { $courses_code = $a_courses ['c_id']; - -//on sort le c_id avec le code du cours +//on sort le c_id avec le code du cours //$sql8 = "SELECT * // FROM course // WHERE code = '$courses_code' // "; // $result8 = Database::query($sql8); // $course_code_id = Database::fetch_array($result8) ; - $c_id = $courses_code - + $c_id = $courses_code; //pours chaque cours dans lequel il est inscrit, on cherche les jours complétés - - ?>

- 300) { break; } @@ -185,90 +169,84 @@ if ($diff > 0) { } $diff = abs($diff); ?> + +
+ - - - - + $x = $_user['user_id']; + $line1->getPointer()->setStyle(PointerStyle::$CIRCLE); + $chart->getLegend()->setVisible(false); + $chart->render("../garbage/$x-image.png"); + $rand = rand(); + print ''; + */ + ?> + + + - - -
- - getAspect()->setView3D(false); - $chart->getHeader()->setText("Graphique de suivi"); - $chart->getAxes()->getLeft()->setMinimumOffset(10); - $chart->getAxes()->getLeft()->setMaximumOffset(10); - $chart->getAxes()->getBottom()->setMinimumOffset(10); - $chart->getAxes()->getBottom()->setMaximumOffset(10); - $line1 = new Line($chart->getChart()); - $data = $pt; - $line1->addArray($data); - foreach ($chart->getSeries() as $serie) { - $pointer = $serie->getPointer(); - $pointer->setVisible(true); - $pointer->getPen()->setVisible(false); - $pointer->setHorizSize(2); - $pointer->setVertSize(2); - - $marks = $serie->getMarks(); - $marks->setVisible(true); - $marks->setArrowLength(5); - $marks->getArrow()->setVisible(false); - $marks->setTransparent(true); - } + //graphique de suivi + + /*include "../inc/teechartphp/sources/TChart.php"; + $chart = new TChart(500, 300); + $chart->getAspect()->setView3D(false); + $chart->getHeader()->setText("Graphique de suivi"); + $chart->getAxes()->getLeft()->setMinimumOffset(10); + $chart->getAxes()->getLeft()->setMaximumOffset(10); + $chart->getAxes()->getBottom()->setMinimumOffset(10); + $chart->getAxes()->getBottom()->setMaximumOffset(10); + $line1 = new Line($chart->getChart()); + $data = $pt; + $line1->addArray($data); + foreach ($chart->getSeries() as $serie) { + $pointer = $serie->getPointer(); + $pointer->setVisible(true); + $pointer->getPen()->setVisible(false); + $pointer->setHorizSize(2); + $pointer->setVertSize(2); + + $marks = $serie->getMarks(); + $marks->setVisible(true); + $marks->setArrowLength(5); + $marks->getArrow()->setVisible(false); + $marks->setTransparent(true); + } - $x = $_user['user_id']; - $line1->getPointer()->setStyle(PointerStyle::$CIRCLE); - $chart->getLegend()->setVisible(false); - $chart->render("../garbage/$x-image.png"); - $rand = rand(); - print ''; - */ - ?> -
- :

-
+ :

+

+
:

+
:

- +

-
- -
"; $exe_id = $a_inter['exe_id']; - } if ($level == 3) { - echo ' ', $limit, ''; + echo ' '; + echo $limit; + echo ''; } ?> -

@@ -277,26 +255,21 @@ $diff = abs($diff);
".$a_inter['level']." @@ -309,18 +282,17 @@ $diff = abs($diff);

'.get_lang('Course').''; - echo ''; echo ' - - - + + + - - - '; + + '; //on recherche les cours où sont inscrit les user $user_c_id = $_user['user_id']; $sql2 = "SELECT c_id, user_id - FROM course_rel_user - WHERE user_id = '$user_id' - "; + FROM course_rel_user + WHERE user_id = '$user_id'"; $result2 = Database::query($sql2); - while ($a_courses = Database::fetch_array($result2)) { $courses_code = $a_courses ['c_id']; - //on sort le c_id avec le code du cours $sql8 = "SELECT title, code - FROM course - WHERE id = '$courses_code' - "; + FROM course + WHERE id = '$courses_code'"; $result8 = Database::query($sql8); $course_code_id = Database::fetch_array($result8); $c_id = $courses_code; - - $c_title = $course_code_id ['title']; - - + $c_title = $course_code_id['title']; // Francois Belisle Kezber // The Tracking Class still uses the course code rather then the course id. $tracking_c_code = $course_code_id['code']; - // time spent on the course $time_spent_on_course = api_time_to_hms(Tracking:: get_time_spent_on_the_course($user_id, $c_id, $session_id)); - // firts connection date $sql2 = "SELECT STR_TO_DATE(access_date,'%Y-%m-%d') FROM $tbl_stats_access @@ -400,15 +358,12 @@ while ($a_courses = Database::fetch_array($result2)) { //pour trouver la date de fin prévue du module $end_date_module = get_lang('hors_cal'); - //on trouve le nombre de jour pour ce module $sql = "SELECT * FROM c_cal_set_module where c_id = '$c_id'"; - $res = Database::query($sql); $resulta = Database::fetch_array($res); $nombre_heure = $resulta['minutes']; - // on trouve le nombre de minute par jour $sql = "SELECT * FROM c_cal_horaire where c_id = '$c_id_horaire' @@ -418,7 +373,6 @@ while ($a_courses = Database::fetch_array($result2)) { $res = Database::query($sql); $resulta = Database::fetch_array($res); $nombre_minutes = (int) $resulta['num_minute']; - //on calcule le nombre de jour par module $nombre_jours_module = 0; if (!empty($nombre_minutes)) { @@ -428,7 +382,6 @@ while ($a_courses = Database::fetch_array($result2)) { $nombre_jours_module = (int) $nombre_jours_module; //on trouve la date de fin de chaque module AND date = date_format('$first_connection_date_to_module','%Y-%m-%d') - $sql = "SELECT * FROM c_cal_dates WHERE horaire_name = '$nom_hor' AND @@ -438,30 +391,20 @@ while ($a_courses = Database::fetch_array($result2)) { LIMIT $nombre_jours_module, 18446744073709551615 "; $res = Database::query($sql); - //Database::data_seek($res,$nombre_jours_module); $row = Database::fetch_row($res); - $end_date_module = $row[1]; - - -//fin de trouver la date de fin prévue du module - -//progression en % + //fin de trouver la date de fin prévue du module + //progression en % $t_lp = Database:: get_course_table(TABLE_LP_MAIN); $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE c_id = '$c_id' ORDER BY lp.display_order"; $rs_lp = Database::query($sql_lp); - - $i = 0; while ($learnpath = Database:: fetch_array($rs_lp)) { - $lp_id = intval($learnpath['id']); $lp_name = $learnpath['name']; $any_result = false; - // Get progress in lp - // Francois Belisle Kezber // Course Code passed rather then course_id $progress = Tracking::get_avg_student_progress( @@ -489,7 +432,6 @@ while ($a_courses = Database::fetch_array($result2)) { $any_result = true; } - if ($i % 2 == 0) { $css_class = "row_even"; } else { @@ -503,33 +445,26 @@ while ($a_courses = Database::fetch_array($result2)) { } else { $progress = '-'; } - $data_learnpath[/*$i*/ $lp_id][] = $progress.'%'; } - $warming = ''; $today = date('Y-m-d'); - if (isset($end_date_module) && $end_date_module <= $today AND $progress != '100%') { $warming = ' '.get_lang('limite_atteinte').''; } - $end_date_module = $end_date_module.$warming; echo ' - - - + + + '; echo ''; } echo '
'.get_lang('Course').''.get_lang('Time').''.get_lang('FirstConnexion').''.get_lang('Course').''.get_lang('Time').''.get_lang('FirstConnexion').' '.get_lang('Progress').''.get_lang('fin_mod_prevue').'
'.get_lang('fin_mod_prevue').'
'.$c_title.''.$time_spent_on_course.''.$first_connection_date_to_module.''.$c_title.''.$time_spent_on_course.''.$first_connection_date_to_module.' '.$progress.' '.$end_date_module.'
'; - - ?>


-
@@ -540,18 +475,10 @@ echo '
'; - - - - - - - - - - - - + + + + '; $now = date('Y-m-d'); @@ -161,7 +157,6 @@ $table->set_header(9, get_lang('save_diff'), false, 'align="center"'); $table->set_header(10, get_lang('GroupCalendar'), false, 'align="center"'); $table->set_header(11, get_lang('Details'), false); - // Database table definition $table_group_user = Database:: get_course_table(TABLE_GROUP_USER); $table_user = Database:: get_main_table(TABLE_MAIN_USER); @@ -174,26 +169,25 @@ $tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCIS $tbl_stats_exercices_temp = Database:: get_main_table(track_e_exercices_temp); $tbl_group_course_info = Database:: get_course_table(TABLE_GROUP); $course_id = api_get_course_int_id(); -//echo($course_id); -//on trouve le vrai groupID +//on trouve le vrai groupID $sql = "SELECT iid FROM ".$tbl_group_course_info." where c_id=".$course_id." and id=".$current_group['id']; $current_group_result = Database::query($sql); $current_group = Database::fetch_assoc($current_group_result)['iid']; //on trouve les user dans le groupe $sql = "SELECT * - FROM ".$table_user." user, ".$table_group_user." group_rel_user - WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id - AND group_rel_user.group_id = ".$current_group." order by lastname - "; -//echo($sql); + FROM ".$table_user." user, ".$table_group_user." group_rel_user + WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id + AND group_rel_user.group_id = ".$current_group." order by lastname + "; + $result = Database::query($sql); // Francois Belisle Kezber // Le TableDisplay contient une fonction qui set les headers... les headers sont plac�s dans la Row 0... Ce qui ecrase le contenue // le la vrai row 0... Il faut donc ajouter un empty record a la row 0 qui se fera ecras� par lesh headers plutot que le premier record // en ajoutant un empty record, ca fonctionne, mais il faut trouver pourquoi les headers ecrasent le premier record -$row = array(); +$row = []; $row[] = $student_datas['official_code']; $row[] = $student_datas['lastname']; @@ -218,33 +212,22 @@ foreach ($all_datas as $row) { $table->addRow($row); } - while ($resulta = Database::fetch_array($result)) { $user_in_groupe = $resulta ['user_id']; unset($all_datas); - //on cherche les examens - $sqlexam = "SELECT mod_no - FROM $tbl_stats_exercices - WHERE exe_user_id = '$user_in_groupe' - AND c_id = '0' AND (score_ex = 'SU' || score_rep1 = 'SU' || score_rep2 ='SU') - ORDER BY mod_no ASC - "; + FROM $tbl_stats_exercices + WHERE exe_user_id = '$user_in_groupe' + AND c_id = '0' AND (score_ex = 'SU' || score_rep1 = 'SU' || score_rep2 ='SU') + ORDER BY mod_no ASC"; $resultexam = Database::query($sqlexam); - while ($a_exam = Database::fetch_array($resultexam)) { - $exam = "$exam - $a_exam[0]"; - } - Database::query( - "INSERT INTO $tbl_stats_exercices_temp -(id, exe_user_id, mod_passed) VALUES('', '$user_in_groupe', '$exam') " + "INSERT INTO $tbl_stats_exercices_temp (id, exe_user_id, mod_passed) VALUES('', '$user_in_groupe', '$exam') " ); - unset($exam); - //fin de exam //on compte le nombre de m% dans l'agenda pour chaque module /* @@ -263,16 +246,10 @@ while ($resulta = Database::fetch_array($result)) { } //fin des jour de l'agenda */ - $course_code = $_course['id']; - -//$student_datas = UserManager :: get_user_info_by_id($user_in_groupe); $student_datas = api_get_user_info($user_in_groupe); - - -// affichage des jours complétés dans les parcours par chaque élève - -//on recherche les cours où sont inscrit les user + // affichage des jours complétés dans les parcours par chaque élève + //on recherche les cours où sont inscrit les user $sql2 = "SELECT c_id, user_id FROM course_rel_user WHERE user_id = '$user_in_groupe' @@ -280,10 +257,8 @@ while ($resulta = Database::fetch_array($result)) { $result2 = Database::query($sql2); $Total = 0; while ($a_courses = Database::fetch_array($result2)) { - $Courses_code = $a_courses ['c_id']; $Courses_rel_user_id = $a_courses ['user_id']; - //on sort le temps passé dans chaque cours $sql = "SELECT SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds FROM track_e_course_access @@ -315,9 +290,6 @@ while ($resulta = Database::fetch_array($result)) { WHERE user_id = '$Courses_rel_user_id' AND c_id = '$c_id' "; - - // echo $Req3.'
'; - $res3 = Database::query($Req3); while ($result3 = Database::fetch_array($res3)) { $lp_id = $result3['lp_id']; @@ -347,18 +319,14 @@ while ($resulta = Database::fetch_array($result)) { while ($resul5 = Database::fetch_array($res5)) { $max = $resul5['0']; - $Req6 = "SELECT COUNT( id ) - FROM c_lp_item_view - WHERE id = '$max' + FROM c_lp_item_view + WHERE id = '$max' AND c_id = '$c_id_view' "; $res6 = Database::query($Req6); - while ($resultat6 = Database::fetch_array($res6)) { - $Total = $Total + $resultat6[0]; - } } } @@ -368,18 +336,14 @@ while ($resulta = Database::fetch_array($result)) { // on recherche les exam sauvegardé dans la table temp $sqlexamtot = "SELECT mod_passed - FROM $tbl_stats_exercices_temp - WHERE exe_user_id = '$user_in_groupe' + FROM $tbl_stats_exercices_temp + WHERE exe_user_id = '$user_in_groupe' "; $resultexamtot = Database::query($sqlexamtot); - $a_examtot = Database::fetch_array($resultexamtot); - $exampass = $a_examtot['mod_passed']; - //on trouve le nombre dans l'agenda selon la date d'aujourdhui -//si rien n'est inscrit cette journée dans l'agenda, recule de -1 - + //si rien n'est inscrit cette journée dans l'agenda, recule de -1 unset($jour_agenda); $tour = -1; while ($jour_agenda == '') { @@ -387,25 +351,20 @@ while ($resulta = Database::fetch_array($result)) { $date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $tour, date("Y"))); $sql4 = "SELECT * FROM $tbl_personal_agenda - WHERE user = '$user_in_groupe' AND + WHERE user = '$user_in_groupe' AND text='Pour le calendrier, ne pas effacer' AND date like '".$date." %:%' "; - $result4 = Database::query($sql4); - $res4 = Database::fetch_array($result4); $jour_agenda = $res4['title']; - if ($tour > 300) { break; } } - -//on affiche la différence + //on affiche la différence $diff = $jour_agenda - $Total; - if ($diff > 0) { $sing = ''; } else { @@ -429,7 +388,7 @@ while ($resulta = Database::fetch_array($result)) { $last_connection_date = get_lang('NoConnexion'); } // on présente tous les résultats - $row = array(); + $row = []; $row[] = $student_datas['official_code']; $row[] = $student_datas['lastname']; diff --git a/main/extra/update_exam.php b/main/extra/update_exam.php index 18bdff4f7d..cd86852493 100644 --- a/main/extra/update_exam.php +++ b/main/extra/update_exam.php @@ -10,22 +10,19 @@ if (empty($allow)) { $tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); -//$ex_idd =isset($_POST['exe_id'])?$_POST['exe_id']:""; -//$ex_user_id =isset($_POST['ex_user_id'])?$_POST['ex_user_id']:""; -//$mod_no=isset($_POST['mod_no'])?$_POST['mod_no']:""; -//$score_ex=isset($_POST['score_ex'])?$_POST['score_ex']:""; -//$score_rep1=isset($_POST['score_rep1'])?$_POST['score_rep1']:""; -//$score_rep2=isset($_POST['score_rep2'])?$_POST['score_rep2']:""; -//$coment=isset($_POST['coment'])?$_POST['coment']:""; -//$student_id =isset($_POST['student_id'])?$_POST['student_id']:""; +$ex_idd = isset($_POST['exe_id']) ? (int) $_POST['exe_id'] : ''; +$ex_user_id = isset($_POST['ex_user_id']) ? (int) $_POST['ex_user_id'] : ''; +$mod_no = isset($_POST['mod_no']) ? Database::escape_string($_POST['mod_no']) : ''; +$score_ex = isset($_POST['score_ex']) ? Database::escape_string($_POST['score_ex']) : ''; +$score_rep1 = isset($_POST['score_rep1']) ? Database::escape_string($_POST['score_rep1']) : ''; +$score_rep2 = isset($_POST['score_rep2']) ? Database::escape_string($_POST['score_rep2']) : ''; +$coment = isset($_POST['coment']) ? Database::escape_string($_POST['coment']) : ''; +$student_id = isset($_POST['student_id']) ? Database::escape_string($_POST['student_id']) : ''; -foreach ($_POST as $index => $valeur) { - $$index = Database::escape_string(trim($valeur)); -} -$sql4 = "UPDATE $tbl_stats_exercices SET +$sql = "UPDATE $tbl_stats_exercices SET mod_no='$mod_no', score_ex='$score_ex', score_rep1='$score_rep1', score_rep2='$score_rep2', coment='$coment' WHERE exe_id = '$ex_idd' "; -Database::query($sql4); +Database::query($sql); header("location:../extra/myStudents.php?student=$student_id"); exit; diff --git a/main/extra/update_intervention.php b/main/extra/update_intervention.php index 2db08452c5..aa25a62129 100644 --- a/main/extra/update_intervention.php +++ b/main/extra/update_intervention.php @@ -8,18 +8,11 @@ if (empty($allow)) { exit; } -$tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); - -$ex_id = isset($_POST['exe_id']) ? $_POST['exe_id'] : ""; -$student_id = isset($_POST['student_id']) ? $_POST['student_id'] : ""; -$inter_coment = isset($_POST['inter_coment']) ? $_POST['inter_coment'] : ""; - -foreach ($_POST as $index => $valeur) { - $$index = Database::escape_string(trim($valeur)); -} -$sql4 = "UPDATE $tbl_stats_exercices SET inter_coment='$inter_coment' - WHERE exe_id = '$ex_id' - "; -Database::query($sql4); +$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); +$ex_id = isset($_POST['exe_id']) ? (int) $_POST['exe_id'] : ''; +$student_id = isset($_POST['student_id']) ? (int) $_POST['student_id'] : ''; +$inter_coment = isset($_POST['inter_coment']) ? Database::escape_string($_POST['inter_coment']) : ''; +$sql = "UPDATE $table SET inter_coment='$inter_coment' WHERE exe_id = '$ex_id' "; +Database::query($sql); header("location:../extra/myStudents.php?student=$student_id"); exit; \ No newline at end of file diff --git a/main/extra/upgrade_school_calendar.php b/main/extra/upgrade_school_calendar.php index c48deaad36..4ac1eeaaa2 100644 --- a/main/extra/upgrade_school_calendar.php +++ b/main/extra/upgrade_school_calendar.php @@ -23,17 +23,11 @@ foreach ($_POST as $index => $valeur) { } ?> - - - - -