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

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

main/announcements/announcements.php 1 location

@@ 148-152 (lines=5) @@
145
        $searchForm->addElement('text', 'keyword', get_lang('Title'));
146
        $users = CourseManager::get_user_list_from_course_code(api_get_course_id(), $sessionId);
147
        $userList = array('' => '');
148
        if (!empty($users)) {
149
            foreach ($users as $user) {
150
                $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
151
            }
152
        }
153
        $users = [];
154
        $searchForm->addElement('select', 'user_id', get_lang('Users'), $userList);
155
        $searchForm->addButtonSearch(get_lang('Search'));

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

@@ 4859-4867 (lines=9) @@
4856
    ) {
4857
        $coaches = self::getCoachesByCourseSession($sessionId, $courseId);
4858
        $list = array();
4859
        if (!empty($coaches)) {
4860
            foreach ($coaches as $coachId) {
4861
                $userInfo = api_get_user_info($coachId);
4862
                $list[] = api_get_person_name(
4863
                    $userInfo['firstname'],
4864
                    $userInfo['lastname']
4865
                );
4866
            }
4867
        }
4868
4869
        return array_to_string($list, CourseManager::USER_SEPARATOR);
4870
    }