| @@ 30-46 (lines=17) @@ | ||
| 27 | * @author isaac flores paz |
|
| 28 | * @return array |
|
| 29 | */ |
|
| 30 | public static function show_list_type_friends() |
|
| 31 | { |
|
| 32 | $friend_relation_list = array(); |
|
| 33 | $tbl_my_friend_relation_type = Database :: get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE); |
|
| 34 | $sql = 'SELECT id,title FROM '.$tbl_my_friend_relation_type.' |
|
| 35 | WHERE id<>6 ORDER BY id ASC'; |
|
| 36 | $result = Database::query($sql); |
|
| 37 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
| 38 | $friend_relation_list[] = $row; |
|
| 39 | } |
|
| 40 | $count_list = count($friend_relation_list); |
|
| 41 | if ($count_list == 0) { |
|
| 42 | $friend_relation_list[] = get_lang('Unknown'); |
|
| 43 | } else { |
|
| 44 | return $friend_relation_list; |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Get relation type contact by name |
|
| @@ 3873-3889 (lines=17) @@ | ||
| 3870 | * @param string $userId |
|
| 3871 | * @return array containing all the titles of the user defined courses with the id as key of the array |
|
| 3872 | */ |
|
| 3873 | public static function get_user_course_categories($userId = '') |
|
| 3874 | { |
|
| 3875 | if ($userId == '') { |
|
| 3876 | $realUserId = api_get_user_id(); |
|
| 3877 | } else { |
|
| 3878 | $realUserId = $userId; |
|
| 3879 | } |
|
| 3880 | ||
| 3881 | $output = array(); |
|
| 3882 | $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
|
| 3883 | $sql = "SELECT * FROM $table_category WHERE user_id = '".intval($realUserId)."'"; |
|
| 3884 | $result = Database::query($sql); |
|
| 3885 | while ($row = Database::fetch_array($result)) { |
|
| 3886 | $output[$row['id']] = $row['title']; |
|
| 3887 | } |
|
| 3888 | return $output; |
|
| 3889 | } |
|
| 3890 | ||
| 3891 | /** |
|
| 3892 | * Return an array the user_category id and title for the course $courseId for user $userId |
|
| @@ 3935-3950 (lines=16) @@ | ||
| 3932 | * @param int Drh id |
|
| 3933 | * @return array Student list |
|
| 3934 | */ |
|
| 3935 | public static function get_student_followed_by_drh($hr_dept_id) |
|
| 3936 | { |
|
| 3937 | $hr_dept_id = intval($hr_dept_id); |
|
| 3938 | $a_students = array(); |
|
| 3939 | $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 3940 | ||
| 3941 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
|
| 3942 | WHERE hr_dept_id='.$hr_dept_id; |
|
| 3943 | $rs = Database::query($sql); |
|
| 3944 | ||
| 3945 | while($user = Database :: fetch_array($rs)) { |
|
| 3946 | $a_students[$user['user_id']] = $user['user_id']; |
|
| 3947 | } |
|
| 3948 | ||
| 3949 | return $a_students; |
|
| 3950 | } |
|
| 3951 | ||
| 3952 | ||
| 3953 | ||