Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 113-126 (lines=14) @@
110
        }
111
112
        foreach ($all_tools as & $tool) {
113
            if ($tool['image'] == 'scormbuilder.gif') {
114
                // check if the published learnpath is visible for student
115
                $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
116
                if (!api_is_allowed_to_edit(null, true) &&
117
                    !learnpath::is_lp_visible_for_student(
118
                        $published_lp_id,
119
                        api_get_user_id(),
120
                        api_get_course_id(),
121
                        api_get_session_id()
122
                    )
123
                ) {
124
                    continue;
125
                }
126
            }
127
128
            if (api_get_session_id() != 0 &&
129
                in_array($tool['name'], array('course_maintenance', 'course_setting'))
@@ 308-322 (lines=15) @@
305
        if (isset($all_tools_list)) {
306
            $lnk = array();
307
            foreach ($all_tools_list as & $tool) {
308
                if ($tool['image'] == 'scormbuilder.gif') {
309
                    // check if the published learnpath is visible for student
310
                    $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
311
312
                    if (!api_is_allowed_to_edit(null, true) &&
313
                        !learnpath::is_lp_visible_for_student(
314
                            $published_lp_id,
315
                            api_get_user_id(),
316
                            api_get_course_id(),
317
                            api_get_session_id()
318
                        )
319
                    ) {
320
                        continue;
321
                    }
322
                }
323
324
                if (api_get_session_id() != 0 &&
325
                    in_array($tool['name'], array('course_maintenance', 'course_setting'))