Code Duplication    Length = 44-48 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 2630-2673 (lines=44) @@
2627
    $form->addElement('text', 'thread_title', get_lang('Title'));
2628
    $form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
2629
    $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
2630
    if ((api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && ($myThread)) {
2631
        // Thread qualify
2632
        if (Gradebook::is_active()) {
2633
            //Loading gradebook select
2634
            GradebookUtils::load_gradebook_select_in_tool($form);
2635
            $form->addElement(
2636
                'checkbox',
2637
                'thread_qualify_gradebook',
2638
                '',
2639
                get_lang('QualifyThreadGradebook'),
2640
                [
2641
                    'id' => 'thread_qualify_gradebook'
2642
                ]
2643
            );
2644
        } else {
2645
            $form->addElement('hidden', 'thread_qualify_gradebook', false);
2646
        }
2647
2648
        $form->addElement('html', '<div id="options_field" style="display:none">');
2649
        $form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'));
2650
        $form->applyFilter('numeric_calification', 'html_filter');
2651
        $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
2652
        $form->applyFilter('calification_notebook_title', 'html_filter');
2653
        $form->addElement(
2654
            'text',
2655
            'weight_calification',
2656
            get_lang('QualifyWeight'),
2657
            array('value' => '0.00', 'onfocus' => "javascript: this.select();")
2658
        );
2659
        $form->applyFilter('weight_calification', 'html_filter');
2660
        $group = array();
2661
        $group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('Yes'), 1);
2662
        $group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('No'), 0);
2663
        $form->addGroup(
2664
            $group,
2665
            '',
2666
            [
2667
                get_lang('ForumThreadPeerScoring'),
2668
                get_lang('ForumThreadPeerScoringComment'),
2669
            ],
2670
            ' '
2671
        );
2672
        $form->addElement('html', '</div>');
2673
    }
2674
2675
    if ($forumSetting['allow_sticky'] && api_is_allowed_to_edit(null, true)) {
2676
        $form->addElement('checkbox', 'thread_sticky', '', get_lang('StickyPost'));
@@ 2805-2852 (lines=48) @@
2802
    $form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
2803
    $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
2804
2805
    if ((api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($myThread)) {
2806
2807
        // Thread qualify
2808
        if (Gradebook::is_active()) {
2809
            //Loading gradebook select
2810
            GradebookUtils::load_gradebook_select_in_tool($form);
2811
            $form->addElement(
2812
                'checkbox',
2813
                'thread_qualify_gradebook',
2814
                '',
2815
                get_lang('QualifyThreadGradebook'),
2816
                'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
2817
            );
2818
        } else {
2819
            $form->addElement('hidden', 'thread_qualify_gradebook', false);
2820
        }
2821
2822
        $form->addElement('html', '<div id="options_field" style="display:none">');
2823
2824
        $form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'));
2825
        $form->applyFilter('numeric_calification', 'html_filter');
2826
2827
        $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
2828
        $form->applyFilter('calification_notebook_title', 'html_filter');
2829
2830
        $form->addElement(
2831
            'text',
2832
            'weight_calification',
2833
            get_lang('QualifyWeight'),
2834
            array('value' => '0.00', 'onfocus' => "javascript: this.select();")
2835
        );
2836
        $form->applyFilter('weight_calification', 'html_filter');
2837
2838
        $group = array();
2839
        $group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('Yes'), 1);
2840
        $group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('No'), 0);
2841
        $form->addGroup(
2842
            $group,
2843
            '',
2844
            [
2845
                get_lang('ForumThreadPeerScoring'),
2846
                get_lang('ForumThreadPeerScoringComment'),
2847
            ],
2848
            ' '
2849
        );
2850
2851
        $form->addElement('html', '</div>');
2852
    }
2853
2854
    if ($forum_setting['allow_sticky'] && api_is_allowed_to_edit(null, true) && $action == 'newthread') {
2855
        $form->addElement('checkbox', 'thread_sticky', '', get_lang('StickyPost'));