Code Duplication    Length = 4-10 lines in 5 locations

main/inc/lib/search/tool_processors/document_processor.class.php 1 location

@@ 100-103 (lines=4) @@
97
                // get author
98
                $author = '';
99
                $item_result = Database::query($sql);
100
                if ($row = Database::fetch_array($item_result)) {
101
                    $user_data = api_get_user_info($row['insert_user_id']);
102
                    $author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
103
                }
104
            }
105
            return array($thumbnail, $image, $name, $author, $url); // FIXME: is it posible to get an author here?
106
        } else {

main/inc/lib/search/tool_processors/link_processor.class.php 1 location

@@ 118-121 (lines=4) @@
115
            // get author
116
            $author = '';
117
            $item_result = Database::query($sql);
118
            if ($row = Database::fetch_array($item_result)) {
119
                $user_data = api_get_user_info($row['insert_user_id']);
120
                $author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
121
            }
122
123
            return array($thumbnail, $image, $name, $author, $url);
124
        } else {

main/announcements/announcements.php 1 location

@@ 177-181 (lines=5) @@
174
        $searchForm->addElement('text', 'keyword', get_lang('Title'));
175
        $users = CourseManager::get_user_list_from_course_code(api_get_course_id(), $sessionId);
176
        $userList = array('' => '');
177
        if (!empty($users)) {
178
            foreach ($users as $user) {
179
                $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
180
            }
181
        }
182
        $users = [];
183
        $searchForm->addElement('select', 'user_id', get_lang('Users'), $userList);
184
        $searchForm->addButtonSearch(get_lang('Search'));

main/inc/lib/pdf.lib.php 1 location

@@ 645-654 (lines=10) @@
642
            $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']);
643
644
            $teachers = '';
645
            if (!empty($teacher_list)) {
646
                foreach ($teacher_list as $teacher) {
647
                    if ($teacher['user_id'] != $userId) {
648
                        continue;
649
                    }
650
651
                    // Do not show the teacher list see BT#4080 only the current teacher name
652
                    $teachers = api_get_person_name($teacher['firstname'], $teacher['lastname']);
653
                }
654
            }
655
656
            $organization = ChamiloApi::getPlatformLogo();
657
            // Use custom logo image.

main/inc/lib/sessionmanager.lib.php 1 location

@@ 5345-5353 (lines=9) @@
5342
    ) {
5343
        $coaches = self::getCoachesByCourseSession($sessionId, $courseId);
5344
        $list = array();
5345
        if (!empty($coaches)) {
5346
            foreach ($coaches as $coachId) {
5347
                $userInfo = api_get_user_info($coachId);
5348
                $list[] = api_get_person_name(
5349
                    $userInfo['firstname'],
5350
                    $userInfo['lastname']
5351
                );
5352
            }
5353
        }
5354
5355
        return array_to_string($list, CourseManager::USER_SEPARATOR);
5356
    }