Code Duplication    Length = 20-22 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 6944-6965 (lines=22) @@
6941
                $s .= $form->return_form();
6942
            } elseif ($answerType == ORAL_EXPRESSION) {
6943
                // Add nanogong
6944
                if (api_get_setting('document.enable_nanogong') == 'true') {
6945
6946
                    //@todo pass this as a parameter
6947
                    global $exercise_stat_info, $exerciseId;
6948
6949
                    if (!empty($exercise_stat_info)) {
6950
                        $params = array(
6951
                            'exercise_id' => $exercise_stat_info['exe_exo_id'],
6952
                            'exe_id' => $exercise_stat_info['exe_id'],
6953
                            'question_id' => $questionId
6954
                        );
6955
                    } else {
6956
                        $params = array(
6957
                            'exercise_id' => $exerciseId,
6958
                            'exe_id' => 'temp_exe',
6959
                            'question_id' => $questionId
6960
                        );
6961
                    }
6962
6963
                    $nano = new Nanogong($params);
6964
                    $s .= $nano->show_button();
6965
                }
6966
6967
                $form->addElement('html_editor', "choice[".$questionId."]", null, array('id' => "choice[".$questionId."]"), array('ToolbarSet' => 'TestFreeAnswer'));
6968
                //$form->setDefaults(array("choice[".$questionId."]" => $content));

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

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