Code Duplication    Length = 4-9 lines in 4 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

@@ 162-166 (lines=5) @@
159
        $searchForm->addElement('text', 'keyword', get_lang('Title'));
160
        $users = CourseManager::get_user_list_from_course_code(api_get_course_id(), $sessionId);
161
        $userList = array('' => '');
162
        if (!empty($users)) {
163
            foreach ($users as $user) {
164
                $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
165
            }
166
        }
167
        $users = [];
168
        $searchForm->addElement('select', 'user_id', get_lang('Users'), $userList);
169
        $searchForm->addButtonSearch(get_lang('Search'));

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

@@ 5071-5079 (lines=9) @@
5068
    ) {
5069
        $coaches = self::getCoachesByCourseSession($sessionId, $courseId);
5070
        $list = array();
5071
        if (!empty($coaches)) {
5072
            foreach ($coaches as $coachId) {
5073
                $userInfo = api_get_user_info($coachId);
5074
                $list[] = api_get_person_name(
5075
                    $userInfo['firstname'],
5076
                    $userInfo['lastname']
5077
                );
5078
            }
5079
        }
5080
5081
        return array_to_string($list, CourseManager::USER_SEPARATOR);
5082
    }