Code Duplication    Length = 20-22 lines in 2 locations

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(

main/exercice/exercise.class.php 1 location

@@ 7014-7035 (lines=22) @@
7011
                $s .= $form->return_form();
7012
            } elseif ($answerType == ORAL_EXPRESSION) {
7013
                // Add nanogong
7014
                if (api_get_setting('document.enable_nanogong') == 'true') {
7015
7016
                    //@todo pass this as a parameter
7017
                    global $exercise_stat_info, $exerciseId;
7018
7019
                    if (!empty($exercise_stat_info)) {
7020
                        $params = array(
7021
                            'exercise_id' => $exercise_stat_info['exe_exo_id'],
7022
                            'exe_id' => $exercise_stat_info['exe_id'],
7023
                            'question_id' => $questionId
7024
                        );
7025
                    } else {
7026
                        $params = array(
7027
                            'exercise_id' => $exerciseId,
7028
                            'exe_id' => 'temp_exe',
7029
                            'question_id' => $questionId
7030
                        );
7031
                    }
7032
7033
                    $nano = new Nanogong($params);
7034
                    $s .= $nano->show_button();
7035
                }
7036
7037
                $form->addElement('html_editor', "choice[".$questionId."]", null, array('id' => "choice[".$questionId."]"), array('ToolbarSet' => 'TestFreeAnswer'));
7038
                //$form->setDefaults(array("choice[".$questionId."]" => $content));