| @@ 1985-2028 (lines=44) @@ | ||
| 1982 | * @param bool $add_link_to_profile Whether to add a link to the teacher's profile |
|
| 1983 | * @return string List of teachers teaching the course |
|
| 1984 | */ |
|
| 1985 | public static function get_teacher_list_from_course_code_to_string( |
|
| 1986 | $course_code, |
|
| 1987 | $separator = self::USER_SEPARATOR, |
|
| 1988 | $add_link_to_profile = false, |
|
| 1989 | $orderList = false |
|
| 1990 | ) { |
|
| 1991 | $teacher_list = self::get_teacher_list_from_course_code($course_code); |
|
| 1992 | $html = ''; |
|
| 1993 | $list = array(); |
|
| 1994 | if (!empty($teacher_list)) { |
|
| 1995 | foreach ($teacher_list as $teacher) { |
|
| 1996 | $teacher_name = api_get_person_name( |
|
| 1997 | $teacher['firstname'], |
|
| 1998 | $teacher['lastname'] |
|
| 1999 | ); |
|
| 2000 | if ($add_link_to_profile) { |
|
| 2001 | $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $teacher['user_id']; |
|
| 2002 | $teacher_name = Display::url( |
|
| 2003 | $teacher_name, |
|
| 2004 | $url, |
|
| 2005 | [ |
|
| 2006 | 'class' => 'ajax', |
|
| 2007 | 'data-title' => $teacher_name |
|
| 2008 | ] |
|
| 2009 | ); |
|
| 2010 | } |
|
| 2011 | $list[] = $teacher_name; |
|
| 2012 | } |
|
| 2013 | ||
| 2014 | if (!empty($list)) { |
|
| 2015 | if ($orderList === true) { |
|
| 2016 | $html .= '<ul class="user-teacher">'; |
|
| 2017 | foreach ($list as $teacher){ |
|
| 2018 | $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher); |
|
| 2019 | } |
|
| 2020 | $html .= '</ul>'; |
|
| 2021 | } else { |
|
| 2022 | $html .= array_to_string($list, $separator); |
|
| 2023 | } |
|
| 2024 | } |
|
| 2025 | } |
|
| 2026 | ||
| 2027 | return $html; |
|
| 2028 | } |
|
| 2029 | ||
| 2030 | /** |
|
| 2031 | * This function returns information about coachs from a course in session |
|
| @@ 2086-2127 (lines=42) @@ | ||
| 2083 | * @param bool $add_link_to_profile |
|
| 2084 | * @return string |
|
| 2085 | */ |
|
| 2086 | public static function get_coachs_from_course_to_string( |
|
| 2087 | $session_id = 0, |
|
| 2088 | $courseId = 0, |
|
| 2089 | $separator = self::USER_SEPARATOR, |
|
| 2090 | $add_link_to_profile = false, |
|
| 2091 | $orderList = false |
|
| 2092 | ) { |
|
| 2093 | $coachList = self::get_coachs_from_course($session_id, $courseId); |
|
| 2094 | $course_coachs = array(); |
|
| 2095 | if (!empty($coachList)) { |
|
| 2096 | foreach ($coachList as $coach_course) { |
|
| 2097 | $coach_name = $coach_course['full_name']; |
|
| 2098 | if ($add_link_to_profile) { |
|
| 2099 | $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coach_course['user_id']; |
|
| 2100 | $coach_name = Display::url( |
|
| 2101 | $coach_name, |
|
| 2102 | $url, |
|
| 2103 | [ |
|
| 2104 | 'class' => 'ajax', |
|
| 2105 | 'data-title' => $coach_name |
|
| 2106 | ] |
|
| 2107 | ); |
|
| 2108 | } |
|
| 2109 | $course_coachs[] = $coach_name; |
|
| 2110 | } |
|
| 2111 | } |
|
| 2112 | ||
| 2113 | $html = ''; |
|
| 2114 | if (!empty($course_coachs)) { |
|
| 2115 | if ($orderList === true) { |
|
| 2116 | $html .= '<ul class="user-coachs">'; |
|
| 2117 | foreach ($course_coachs as $coachs) { |
|
| 2118 | $html .= Display::tag( |
|
| 2119 | 'li', |
|
| 2120 | Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY) . ' ' . $coachs |
|
| 2121 | ); |
|
| 2122 | } |
|
| 2123 | $html .= '</ul>'; |
|
| 2124 | } else { |
|
| 2125 | $html = array_to_string($course_coachs, $separator); |
|
| 2126 | } |
|
| 2127 | } |
|
| 2128 | ||
| 2129 | return $html; |
|
| 2130 | } |
|