'.COURSE_RELATION_TYPE_RRHH.' AND access_url_id = '.api_get_current_access_url_id().'';
} else {
$sql = 'SELECT course_code FROM '.$tbl_course_user.' WHERE user_id='.intval($_user['user_id']).' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH.' ';
}
$rs = Database::query($sql);
$courses = $course_in_session = array();
while($row = Database :: fetch_array($rs)) {
$courses[$row['course_code']] = CourseManager::get_course_information($row['course_code']);
}
// Get the list of sessions where the user is subscribed as student
if ($_configuration['multiple_access_urls']) {
$sql = 'SELECT DISTINCT cu.course_code, id_session as session_id FROM '.$tbl_session_course_user.' cu INNER JOIN '.$tbl_access_rel_session.' a ON(a.session_id = cu.id_session) WHERE id_user='.$_user['user_id'].' AND access_url_id = '.api_get_current_access_url_id().'';
} else {
$sql = 'SELECT DISTINCT course_code, id_session as session_id FROM '.$tbl_session_course_user.' WHERE id_user='.intval($_user['user_id']);
}
$rs = Database::query($sql);
while($row = Database :: fetch_array($rs)) {
$course_in_session[$row['session_id']][$row['course_code']] = CourseManager::get_course_information($row['course_code']);
}
/*echo '
';
echo $nameTools;
echo '
';*/
if (!empty($courses)) {
?>
';
}
if (!empty($course_in_session)) {
?>
$session) {
echo ''.api_get_session_name($key).'
';
?>
';
}
}
?>
0) {
// get session name and coach of the session
$sql = 'SELECT name, id_coach FROM '.$tbl_session.'
WHERE id='.$session_id;
$rs = Database::query($sql);
$session_name = Database::result($rs, 0, 'name');
$session_coach_id = intval(Database::result($rs, 0, 'id_coach'));
$sql = 'SELECT id_user FROM ' . $tbl_session_course_user . '
WHERE id_session=' . $session_id . '
AND course_code = "' . Database :: escape_string($course) . '" AND status=2';
$rs = Database::query($sql);
$course_coachs = array();
while ($row_coachs = Database::fetch_array($rs)) {
$course_coachs[] = $row_coachs['id_user'];
}
if (!empty($course_coachs)) {
$info_tutor_name = array();
foreach ($course_coachs as $course_coach) {
$coach_infos = UserManager :: get_user_info_by_id($course_coach);
$info_tutor_name[] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
}
$course_info['tutor_name'] = implode(",",$info_tutor_name);
} else if($session_coach_id != 0) {
$coach_info = UserManager :: get_user_info_by_id($session_coach_id);
$course_info['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']);
}
}
} // end if (api_get_setting('use_session_mode') == 'true')*/
//$tableTitle = $course_info['title'].' | '.get_lang('Coach').' : '.$course_info['tutor_name'].((!empty($session_name)) ? ' | '.get_lang('Session').' : '.$session_name : '');
$session_name = api_get_session_name($session_id);
$tableTitle = ((!empty($session_name)) ? ' '.get_lang('Session').' : '.$session_name.' | ' : '').''.$course_info['title'];
?>
|
|
|
|
|
0) {
while($learnpath = Database::fetch_array($result_learnpath)) {
//$progress = learnpath :: get_db_progress($learnpath['id'], $_user['user_id'], 'abs', $course_info['db_name'], false, $session_id);
$progress = Tracking::get_avg_student_progress($_user['user_id'], $course, array($learnpath['id']), $session_id);
$last_connection_in_lp = Tracking::get_last_connection_time_in_lp($_user['user_id'], $course, $learnpath['id'], $session_id);
$time_spent_in_lp = Tracking::get_time_spent_in_lp($_user['user_id'], $course, array($learnpath['id']), $session_id);
$time_spent_in_lp = api_time_to_hms($time_spent_in_lp);
echo "";
echo $learnpath['name'];
echo " |
";
echo $time_spent_in_lp;
echo " |
";
if (is_numeric($progress)) {
$progress = $progress.'%';
}
echo $progress;
echo " |
";
if (!empty($last_connection_in_lp)) {
echo api_get_utc_datetime($last_connection_in_lp);
} else {
echo '-';
}
echo " |
";
}
} else {
echo '
'.get_lang('NoLearnpath').'
|
';
}
// This code was commented on purpose see BT#924
/*$sql = 'SELECT visibility FROM '.$course_info['db_name'].'.'.TABLE_TOOL_LIST.' WHERE name="quiz"';
$result_visibility_tests = Database::query($sql);
if (Database::result($result_visibility_tests, 0, 'visibility') == 1) {*/
if (empty($session_id)) {
$sql_exercices = "SELECT quiz.title,id, results_disabled FROM ".$tbl_course_quiz." AS quiz WHERE active='1' AND session_id = 0";
} else {
$sql_exercices = "SELECT quiz.title,id, results_disabled FROM ".$tbl_course_quiz." AS quiz WHERE active='1'";
}
echo '
'.get_lang('Exercices').' |
'.get_lang('Score').' |
'.get_lang('Attempts').' |
'.get_lang('LatestAttempt').' |
';
$result_exercices = Database::query($sql_exercices);
if (Database::num_rows($result_exercices) > 0) {
while ($exercices = Database::fetch_array($result_exercices)) {
$score = 0;
$weighting = 0;
$exercise_stats = get_all_exercise_results($exercices['id'],$course_info['code'], $session_id);
$attempts = 0;
foreach($exercise_stats as $exercise_stat) {
if ($exercise_stat['exe_user_id'] == $_user['user_id']) {
$score = $score + $exercise_stat['exe_result'];
$weighting = $weighting + $exercise_stat['exe_weighting'];
$exe_id = $exercise_stat['exe_id'];
$attempts++;
}
}
if ($weighting > 0) {
// i.e 10.50%
$percentage_score = round(($score * 100) / $weighting, 2);
} else {
$percentage_score = 0;
}
echo '
';
echo $exercices['title'];
echo ' | ';
if ($exercices['results_disabled'] == 0) {
echo '';
if ($attempts > 0) {
echo $percentage_score.'%';
} else {
echo '/';
}
echo ' | ';
echo '';
echo $attempts;
echo ' |
';
if ($attempts > 0) {
echo ' '.Display::return_icon('quiz.gif', get_lang('Quiz')).' ';
}
echo ' | ';
} else {
// we show or not the results if the teacher wants to
echo '';
echo get_lang('CantShowResults');
echo ' | ';
echo '';
echo ' -- ';
echo ' |
';
echo ' -- ';
echo ' | ';
}
echo '
';
}
} else {
echo ''.get_lang('NoEx').' |
';
}
?>