Code Duplication    Length = 22-24 lines in 2 locations

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

@@ 564-585 (lines=22) @@
561
            $htmlTitre = '';
562
            while ($catLine = Database::fetch_array($resCats)) {
563
                $category_has_open_courses = self::category_has_open_courses($catLine['code']);
564
                if ($category_has_open_courses) {
565
                    // The category contains courses accessible to anonymous visitors.
566
                    $htmlListCat .= '<li>';
567
                    $htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
568
                    if (api_get_setting('show_number_of_courses') == 'true') {
569
                        $htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
570
                    }
571
                    $htmlListCat .= "</li>";
572
                    $thereIsSubCat = true;
573
                } elseif ($catLine['children_count'] > 0) {
574
                    // The category has children, subcategories.
575
                    $htmlListCat .= '<li>';
576
                    $htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
577
                    $htmlListCat .= "</li>";
578
                    $thereIsSubCat = true;
579
                } elseif (api_get_setting('show_empty_course_categories') == 'true') {
580
                    /* End changed code to eliminate the (0 courses) after empty categories. */
581
                      $htmlListCat .= '<li>';
582
                    $htmlListCat .= $catLine['name'];
583
                    $htmlListCat .= "</li>";
584
                    $thereIsSubCat = true;
585
                } // Else don't set thereIsSubCat to true to avoid printing things if not requested.
586
                // TODO: deprecate this useless feature - this includes removing system variable
587
                if (empty($htmlTitre)) {
588
                    $htmlTitre = '<p>';

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

@@ 681-704 (lines=24) @@
678
            while ($catLine = Database::fetch_array($resCats)) {
679
                if ($catLine['code'] != $category) {
680
                    $category_has_open_courses = $this->category_has_open_courses($catLine['code']);
681
                    if ($category_has_open_courses) {
682
                        // The category contains courses accessible to anonymous visitors.
683
                        $htmlListCat .= '<li>';
684
                        $htmlListCat .= '<a href="'.api_get_self(
685
                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
686
                        if (api_get_setting('show_number_of_courses') == 'true') {
687
                            $htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
688
                        }
689
                        $htmlListCat .= "</li>";
690
                        $thereIsSubCat = true;
691
                    } elseif ($catLine['children_count'] > 0) {
692
                        // The category has children, subcategories.
693
                        $htmlListCat .= '<li>';
694
                        $htmlListCat .= '<a href="'.api_get_self(
695
                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
696
                        $htmlListCat .= "</li>";
697
                        $thereIsSubCat = true;
698
                    } elseif (api_get_setting('show_empty_course_categories') == 'true') {
699
                        /* End changed code to eliminate the (0 courses) after empty categories. */
700
                        $htmlListCat .= '<li>';
701
                        $htmlListCat .= $catLine['name'];
702
                        $htmlListCat .= "</li>";
703
                        $thereIsSubCat = true;
704
                    } // Else don't set thereIsSubCat to true to avoid printing things if not requested.
705
                } else {
706
                    $htmlTitre = '<p>';
707
                    if (api_get_setting('show_back_link_on_top_of_tree') == 'true') {