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