User list to PDF, now it shows the current teacher BT#2741

skala
Julio Montoya 13 years ago
parent 96f3aae2d1
commit e14297ff8a
  1. 5
      main/inc/lib/course.lib.php
  2. 29
      main/user/user.php

@ -1283,9 +1283,7 @@ class CourseManager {
}
// We get the session coach.
$rs = Database::query('SELECT id_coach FROM '.Database::get_main_table(TABLE_MAIN_SESSION).
' WHERE id="'.$session_id.'"');
$user_info = array();
$rs = Database::query('SELECT id_coach FROM '.Database::get_main_table(TABLE_MAIN_SESSION).' WHERE id="'.$session_id.'"');
$session_id_coach = Database::result($rs, 0, 'id_coach');
$user_info = Database::get_user_info_from_id($session_id_coach);
$user_info['status'] = $user['status'];
@ -1293,7 +1291,6 @@ class CourseManager {
$user_info['tutor_id'] = $user['tutor_id'];
$user_info['email'] = $user['email'];
$users[$session_id_coach] = $user_info;
return $users;
}

@ -249,15 +249,38 @@ if (api_is_allowed_to_edit(null, true)) {
}
$description .= '<tr><td>'.get_lang('Course').': </td><td class="highlight">'.$course_info['name'].'</td>';
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
$coaches = CourseManager::get_coach_list_from_course_code_to_string($course_info['code'], $session_id);
$teachers = CourseManager::get_teacher_list_from_course_code($course_info['code']);
//If I'm a teacher in this course show just my name
if (isset($teachers[$user_id])) {
if (!empty($teachers)) {
$teacher_info = $teachers[$user_id];
$description .= '<tr><td>'.get_lang('Teacher').': </td><td class="highlight">'.api_get_person_name($teacher_info['firstname'], $teacher_info['lastname']).'</td>';
}
} else {
//If not show all teachers
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
if (!empty($teachers)) {
$description .= '<tr><td>'.get_lang('Teachers').': </td><td class="highlight">'.$teachers.'</td>';
}
if (!empty($coaches)) {
}
if (!empty($session_id)) {
//If I'm a coach
$coaches = CourseManager::get_coach_list_from_course_code($course_info['code'], $session_id);
if (isset($coaches) && isset($coaches[$user_id])) {
$user_info = api_get_user_info($user_id);
$description .= '<tr><td>'.get_lang('Coach').': </td><td class="highlight">'.$user_info['complete_name'].'</td>';
} else {
//If not show everything
$teachers = CourseManager::get_coach_list_from_course_code_to_string($course_info['code'], $session_id);
if (!empty($teachers)) {
$description .= '<tr><td>'.get_lang('Coachs').': </td><td class="highlight">'.$coaches.'</td>';
}
}
}
$description .= '<tr><td>'.get_lang('Date').': </td><td class="highlight">'.api_convert_and_format_date(time(), DATE_TIME_FORMAT_LONG).'</td>';
$description .= '</table>';
$params = array();

Loading…
Cancel
Save