"index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools);
// Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
/*
===============================================================================
MAIN CODE
===============================================================================
*/
if (!empty($_GET['session'])) {
$sql_session = "SELECT name,id
FROM $tbl_session
ORDER BY name ASC";
$result_session = Database::query($sql_session, __FILE__, __LINE__);
echo "".get_lang('MoyCourse')."";
echo "
";
if (Database::num_rows($result_session) > 0) {
echo '
'.get_lang('Session').' | '.get_lang('MoyenneTest').' | '.get_lang('MoyenneExamen').' |
';
while ($session = Database::fetch_array($result_session)) {
$sql_course = "SELECT title,code
FROM $tbl_course as course
INNER JOIN $tbl_session_course AS rel_course
ON course.code = rel_course.course_code
AND rel_course.id_session = ".$session['id']."
ORDER BY title ASC";
$result_course = Database::query($sql_course, __FILE__, __LINE__);
$total_result = 0;
$total_weighting = 0;
while ($course = Database::fetch_array($result_course)) {
$sql_moy_test = "SELECT exe_result,exe_weighting
FROM $tbl_track_exercice
WHERE exe_cours_id = '".$course['code']."'";
$result_moy_test = Database::query($sql_moy_test);
$result = 0;
$weighting = 0;
while ($moy_test = Database::fetch_array($result_moy_test)) {
$result = $result + $moy_test['exe_result'];
$weighting = $weighting + $moy_test['exe_weighting'];
}
$total_result = $total_result + $result;
$total_weighting = $total_weighting + $weighting;
}
if ($total_weighting != 0) {
$moyenne_test = round(($total_result * 100) / $total_weighting);
} else {
$moyenne_test = null;
}
echo ''.$session['name'].' | '.(is_null($moyenne_test) ? '' : $moyenne_test.'%').' | |
';
}
echo '
';
} else {
echo get_lang('NoSession');
}
} else {
$sql_course = "SELECT title,code
FROM $tbl_course as course
ORDER BY title ASC";
$result_course = Database::query($sql_course, __FILE__, __LINE__);
echo "".get_lang('MoySession')."";
echo "
";
if (Database::num_rows($result_course) > 0) {
echo ''.get_lang('Course').' | '.get_lang('MoyenneTest').' | '.get_lang('MoyenneExamen').' |
';
while ($course= Database::fetch_array($result_course)) {
$sql_moy_test = "SELECT exe_result,exe_weighting
FROM $tbl_track_exercice
WHERE exe_cours_id = '".$course['code']."'";
$result_moy_test = Database::query($sql_moy_test, __FILE__, __LINE__);
$result = 0;
$weighting = 0;
while ($moy_test = Database::fetch_array($result_moy_test)) {
$result = $result + $moy_test['exe_result'];
$weighting = $weighting + $moy_test['exe_weighting'];
}
if ($weighting != 0) {
$moyenne_test = round(($result * 100) / $weighting);
} else {
$moyenne_test = null;
}
echo ''.$course['title'].' | '.(is_null($moyenne_test) ? '' : $moyenne_test.'%').' | |
';
}
echo '
';
} else {
echo get_lang('NoCourse');
}
}
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer();