Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 107-120 (lines=14) @@
104
        }
105
106
        foreach ($all_tools as & $tool) {
107
            if ($tool['image'] == 'scormbuilder.gif') {
108
                // check if the published learnpath is visible for student
109
                $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
110
                if (!api_is_allowed_to_edit(null, true) &&
111
                    !learnpath::is_lp_visible_for_student(
112
                        $published_lp_id,
113
                        api_get_user_id(),
114
                        api_get_course_id(),
115
                        api_get_session_id()
116
                    )
117
                ) {
118
                    continue;
119
                }
120
            }
121
122
            if (api_get_session_id() != 0 &&
123
                in_array($tool['name'], array('course_maintenance', 'course_setting'))
@@ 303-317 (lines=15) @@
300
            $lnk = array();
301
            foreach ($all_tools_list as & $tool) {
302
303
                if ($tool['image'] == 'scormbuilder.gif') {
304
                    // check if the published learnpath is visible for student
305
                    $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
306
307
                    if (!api_is_allowed_to_edit(null, true) &&
308
                        !learnpath::is_lp_visible_for_student(
309
                            $published_lp_id,
310
                            api_get_user_id(),
311
                            api_get_course_id(),
312
                            api_get_session_id()
313
                        )
314
                    ) {
315
                        continue;
316
                    }
317
                }
318
319
                if (api_get_session_id() != 0 &&
320
                    in_array($tool['name'], array('course_maintenance', 'course_setting'))