Code Duplication    Length = 48-51 lines in 2 locations

main/create_course/add_course.php 1 location

@@ 168-215 (lines=48) @@
165
    get_lang('FillWithExemplaryContent')
166
);
167
168
if ($course_validation_feature) {
169
170
    // A special URL to terms and conditions that is set
171
    // in the platform settings page.
172
    $terms_and_conditions_url = trim(
173
        api_get_setting('course_validation_terms_and_conditions_url')
174
    );
175
176
    // If the special setting is empty,
177
    // then we may get the URL from Chamilo's module "Terms and conditions",
178
    // if it is activated.
179
    if (empty($terms_and_conditions_url)) {
180
        if (api_get_setting('allow_terms_conditions') === 'true') {
181
            $terms_and_conditions_url = api_get_path(WEB_CODE_PATH).'auth/inscription.php?legal';
182
        }
183
    }
184
185
    if (!empty($terms_and_conditions_url)) {
186
        // Terms and conditions to be accepted before sending a course request.
187
        $form->addElement(
188
            'checkbox',
189
            'legal',
190
            null,
191
            get_lang('IAcceptTermsAndConditions'),
192
            1
193
        );
194
195
        $form->addRule(
196
            'legal',
197
            get_lang('YouHaveToAcceptTermsAndConditions'),
198
            'required'
199
        );
200
        // Link to terms and conditions.
201
        $link_terms_and_conditions = '
202
            <script>
203
            function MM_openBrWindow(theURL, winName, features) { //v2.0
204
                window.open(theURL,winName,features);
205
            }
206
            </script>
207
        ';
208
        $link_terms_and_conditions .= Display::url(
209
            get_lang('ReadTermsAndConditions'),
210
            '#',
211
            ['onclick' => "javascript:MM_openBrWindow('$terms_and_conditions_url', 'Conditions', 'scrollbars=yes, width=800');"]
212
        );
213
        $form->addElement('label', null, $link_terms_and_conditions);
214
    }
215
}
216
217
$obj = new GradeModel();
218
$obj->fill_grade_model_select_in_form($form);

src/Chamilo/CoreBundle/Controller/UserPortalController.php 1 location

@@ 167-217 (lines=51) @@
164
            get_lang('FillWithExemplaryContent')
165
        );
166
167
        if ($courseValidation) {
168
169
            // A special URL to terms and conditions that is set
170
            // in the platform settings page.
171
            $terms_and_conditions_url = trim(
172
                api_get_setting('course_validation_terms_and_conditions_url')
173
            );
174
175
            // If the special setting is empty,
176
            // then we may get the URL from Chamilo's module "Terms and conditions",
177
            // if it is activated.
178
            if (empty($terms_and_conditions_url)) {
179
                if (api_get_setting(
180
                        'registration.allow_terms_conditions'
181
                    ) == 'true'
182
                ) {
183
                    $terms_and_conditions_url = api_get_path(WEB_CODE_PATH);
184
                    $terms_and_conditions_url .= 'auth/inscription.php?legal';
185
                }
186
            }
187
188
            if (!empty($terms_and_conditions_url)) {
189
                // Terms and conditions to be accepted before sending a course request.
190
                $form->addElement(
191
                    'checkbox',
192
                    'legal',
193
                    null,
194
                    get_lang('IAcceptTermsAndConditions'),
195
                    1
196
                );
197
                $form->addRule(
198
                    'legal',
199
                    get_lang('YouHaveToAcceptTermsAndConditions'),
200
                    'required'
201
                );
202
                // Link to terms and conditions.
203
                $link_terms_and_conditions = '
204
                    <script>
205
                    function MM_openBrWindow(theURL, winName, features) { //v2.0
206
                        window.open(theURL,winName,features);
207
                    }
208
                    </script>
209
                ';
210
                $link_terms_and_conditions .= \Display::url(
211
                    get_lang('ReadTermsAndConditions'),
212
                    '#',
213
                    ['onclick' => "javascript:MM_openBrWindow('$terms_and_conditions_url', 'Conditions', 'scrollbars=yes, width=800');"]
214
                );
215
                $form->addElement('label', null, $link_terms_and_conditions);
216
            }
217
        }
218
219
        $obj = new \GradeModel();
220
        $obj->fill_grade_model_select_in_form($form);