Code Duplication    Length = 20-22 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 6997-7018 (lines=22) @@
6994
                $s .= $form->return_form();
6995
            } elseif ($answerType == ORAL_EXPRESSION) {
6996
                // Add nanogong
6997
                if (api_get_setting('document.enable_nanogong') == 'true') {
6998
6999
                    //@todo pass this as a parameter
7000
                    global $exercise_stat_info, $exerciseId;
7001
7002
                    if (!empty($exercise_stat_info)) {
7003
                        $params = array(
7004
                            'exercise_id' => $exercise_stat_info['exe_exo_id'],
7005
                            'exe_id' => $exercise_stat_info['exe_id'],
7006
                            'question_id' => $questionId
7007
                        );
7008
                    } else {
7009
                        $params = array(
7010
                            'exercise_id' => $exerciseId,
7011
                            'exe_id' => 'temp_exe',
7012
                            'question_id' => $questionId
7013
                        );
7014
                    }
7015
7016
                    $nano = new Nanogong($params);
7017
                    $s .= $nano->show_button();
7018
                }
7019
7020
                $form->addElement('html_editor', "choice[".$questionId."]", null, array('id' => "choice[".$questionId."]"), array('ToolbarSet' => 'TestFreeAnswer'));
7021
                //$form->setDefaults(array("choice[".$questionId."]" => $content));

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

@@ 176-195 (lines=20) @@
173
                $s .= $form->returnForm();
174
            } elseif ($answerType == ORAL_EXPRESSION) {
175
                // Add nanog
176
                if (api_get_setting('enable_nanogong') == 'true') {
177
                    //@todo pass this as a parameter
178
                    global $exercise_stat_info, $exerciseId, $exe_id;
179
180
                    if (!empty($exercise_stat_info)) {
181
                        $params = array(
182
                            'exercise_id' => $exercise_stat_info['exe_exo_id'],
183
                            'exe_id' => $exercise_stat_info['exe_id'],
184
                            'question_id' => $questionId
185
                        );
186
                    } else {
187
                        $params = array(
188
                            'exercise_id' => $exerciseId,
189
                            'exe_id' => 'temp_exe',
190
                            'question_id' => $questionId
191
                        );
192
                    }
193
                    $nano = new Nanogong($params);
194
                    echo $nano->show_button();
195
                }
196
197
                $form = new FormValidator('free_choice_'.$questionId);
198
                $config = array(