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'))
@@ 302-316 (lines=15) @@
299
        if (isset($all_tools_list)) {
300
            $lnk = array();
301
            foreach ($all_tools_list as & $tool) {
302
                if ($tool['image'] == 'scormbuilder.gif') {
303
                    // check if the published learnpath is visible for student
304
                    $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
305
306
                    if (!api_is_allowed_to_edit(null, true) &&
307
                        !learnpath::is_lp_visible_for_student(
308
                            $published_lp_id,
309
                            api_get_user_id(),
310
                            api_get_course_id(),
311
                            api_get_session_id()
312
                        )
313
                    ) {
314
                        continue;
315
                    }
316
                }
317
318
                if (api_get_session_id() != 0 &&
319
                    in_array($tool['name'], array('course_maintenance', 'course_setting'))