Code Duplication    Length = 14-15 lines in 2 locations

main/inc/lib/course_home.lib.php 2 locations

@@ 115-128 (lines=14) @@
112
        }
113
114
        foreach ($all_tools as & $tool) {
115
            if ($tool['image'] == 'scormbuilder.gif') {
116
                // check if the published learnpath is visible for student
117
                $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
118
                if (!api_is_allowed_to_edit(null, true) &&
119
                    !learnpath::is_lp_visible_for_student(
120
                        $published_lp_id,
121
                        api_get_user_id(),
122
                        api_get_course_id(),
123
                        api_get_session_id()
124
                    )
125
                ) {
126
                    continue;
127
                }
128
            }
129
130
            if (api_get_session_id() != 0 &&
131
                in_array($tool['name'], array('course_maintenance', 'course_setting'))
@@ 318-332 (lines=15) @@
315
        if (isset($all_tools_list)) {
316
            $lnk = array();
317
            foreach ($all_tools_list as & $tool) {
318
                if ($tool['image'] == 'scormbuilder.gif') {
319
                    // check if the published learnpath is visible for student
320
                    $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
321
322
                    if (!api_is_allowed_to_edit(null, true) &&
323
                        !learnpath::is_lp_visible_for_student(
324
                            $published_lp_id,
325
                            api_get_user_id(),
326
                            api_get_course_id(),
327
                            api_get_session_id()
328
                        )
329
                    ) {
330
                        continue;
331
                    }
332
                }
333
334
                if (api_get_session_id() != 0 &&
335
                    in_array($tool['name'], array('course_maintenance', 'course_setting'))