Code Duplication    Length = 26-27 lines in 2 locations

main/auth/courses_controller.php 2 locations

@@ 659-685 (lines=27) @@
656
     * Show the Session Catalogue with filtered session by course tags
657
     * @param array $limit Limit info
658
     */
659
    public function sessionsListByCoursesTag(array $limit)
660
    {
661
        $searchTag = isset($_POST['search_tag']) ? $_POST['search_tag'] : null;
662
        $searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
663
        $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false;
664
        $courseUrl = getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe');
665
666
        $sessions = $this->model->browseSessionsByTags($searchTag, $limit);
667
        $sessionsBlocks = $this->getFormatedSessionsBlock($sessions);
668
669
        $tpl = new Template();
670
671
        $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
672
        $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
673
        $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
674
        $tpl->assign('course_url', $courseUrl);
675
        $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
676
        $tpl->assign('hidden_links', $hiddenLinks);
677
        $tpl->assign('search_token', Security::get_token());
678
        $tpl->assign('search_date', Security::remove_XSS($searchDate));
679
        $tpl->assign('search_tag', Security::remove_XSS($searchTag));
680
        $tpl->assign('sessions', $sessionsBlocks);
681
682
        $contentTemplate = $tpl->get_template('auth/session_catalog.tpl');
683
684
        $tpl->display($contentTemplate);
685
    }
686
687
    /**
688
     * Show the Session Catalogue with filtered session by a query term
@@ 691-716 (lines=26) @@
688
     * Show the Session Catalogue with filtered session by a query term
689
     * @param array $limit
690
     */
691
    public function sessionListBySearch(array $limit)
692
    {
693
        $q = isset($_REQUEST['q']) ? Security::remove_XSS($_REQUEST['q']) : null;
694
        $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false;
695
        $courseUrl = getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe');
696
        $searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
697
698
        $sessions = $this->model->browseSessionsBySearch($q, $limit);
699
        $sessionsBlocks = $this->getFormatedSessionsBlock($sessions);
700
701
        $tpl = new Template();
702
        $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
703
        $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
704
        $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
705
        $tpl->assign('course_url', $courseUrl);
706
        $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
707
        $tpl->assign('hidden_links', $hiddenLinks);
708
        $tpl->assign('search_token', Security::get_token());
709
        $tpl->assign('search_date', Security::remove_XSS($searchDate));
710
        $tpl->assign('search_tag', Security::remove_XSS($q));
711
        $tpl->assign('sessions', $sessionsBlocks);
712
713
        $contentTemplate = $tpl->get_template('auth/session_catalog.tpl');
714
715
        $tpl->display($contentTemplate);
716
    }
717
718
    /**
719
     * Get the formated data for sessions block to be displayed on Session Catalog page