Code Duplication    Length = 22-24 lines in 2 locations

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

@@ 329-350 (lines=22) @@
326
            $htmlTitre = '';
327
            while ($catLine = Database::fetch_array($resCats)) {
328
                $category_has_open_courses = self::category_has_open_courses($catLine['code']);
329
                if ($category_has_open_courses) {
330
                    // The category contains courses accessible to anonymous visitors.
331
                    $htmlListCat .= '<li>';
332
                    $htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
333
                    if (api_get_setting('show_number_of_courses') == 'true') {
334
                        $htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
335
                    }
336
                    $htmlListCat .= "</li>";
337
                    $thereIsSubCat = true;
338
                } elseif ($catLine['children_count'] > 0) {
339
                    // The category has children, subcategories.
340
                    $htmlListCat .= '<li>';
341
                    $htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
342
                    $htmlListCat .= "</li>";
343
                    $thereIsSubCat = true;
344
                } elseif (api_get_setting('show_empty_course_categories') == 'true') {
345
                    /* End changed code to eliminate the (0 courses) after empty categories. */
346
                      $htmlListCat .= '<li>';
347
                    $htmlListCat .= $catLine['name'];
348
                    $htmlListCat .= "</li>";
349
                    $thereIsSubCat = true;
350
                } // Else don't set thereIsSubCat to true to avoid printing things if not requested.
351
                // TODO: deprecate this useless feature - this includes removing system variable
352
                if (empty($htmlTitre)) {
353
                    $htmlTitre = '<p>';

src/Chamilo/CoreBundle/Framework/PageController.php 1 location

@@ 421-444 (lines=24) @@
418
            while ($catLine = Database::fetch_array($resCats)) {
419
                if ($catLine['code'] != $category) {
420
                    $category_has_open_courses = $this->category_has_open_courses($catLine['code']);
421
                    if ($category_has_open_courses) {
422
                        // The category contains courses accessible to anonymous visitors.
423
                        $htmlListCat .= '<li>';
424
                        $htmlListCat .= '<a href="'.api_get_self(
425
                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
426
                        if (api_get_setting('show_number_of_courses') == 'true') {
427
                            $htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
428
                        }
429
                        $htmlListCat .= "</li>";
430
                        $thereIsSubCat = true;
431
                    } elseif ($catLine['children_count'] > 0) {
432
                        // The category has children, subcategories.
433
                        $htmlListCat .= '<li>';
434
                        $htmlListCat .= '<a href="'.api_get_self(
435
                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
436
                        $htmlListCat .= "</li>";
437
                        $thereIsSubCat = true;
438
                    } elseif (api_get_setting('show_empty_course_categories') == 'true') {
439
                        /* End changed code to eliminate the (0 courses) after empty categories. */
440
                        $htmlListCat .= '<li>';
441
                        $htmlListCat .= $catLine['name'];
442
                        $htmlListCat .= "</li>";
443
                        $thereIsSubCat = true;
444
                    } // Else don't set thereIsSubCat to true to avoid printing things if not requested.
445
                } else {
446
                    $htmlTitre = '<p>';
447
                    if (api_get_setting('show_back_link_on_top_of_tree') == 'true') {