Added coachs from a course in session into progress about an student - partial DT#5496

skala
Cristian Fasanando 15 years ago
parent 22852a7870
commit 1c7fc54e70
  1. 27
      main/auth/my_progress.php

@ -156,18 +156,23 @@ foreach ($courses as $enreg) {
$session_name = Database::result($rs, 0, 'name');
$session_coach_id = intval(Database::result($rs, 0, 'id_coach'));
// get coach of the course in the session
$sql = 'SELECT id_coach FROM '.$tbl_session_course.'
WHERE id_session='.$session_id.'
AND course_code = "'.Database::escape_string($_GET['course']).'"';
$rs = Database::query($sql, __FILE__, __LINE__);
$session_course_coach_id = intval(Database::result($rs, 0, 0));
if ($session_course_coach_id != 0) {
$coach_info = UserManager :: get_user_info_by_id($session_course_coach_id);
$course_info['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']);
$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, __FILE__, __LINE__);
$course_coachs = array();
while ($row_coachs = Database::fetch_array($rs)) {
$course_coachs[] = $row_coachs['id_user'];
}
else if($session_coach_id != 0) {
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']);
}

Loading…
Cancel
Save