Code Duplication    Length = 20-22 lines in 2 locations

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('document.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(

main/exercice/exercise.class.php 1 location

@@ 6933-6954 (lines=22) @@
6930
                $s .= $form->return_form();
6931
            } elseif ($answerType == ORAL_EXPRESSION) {
6932
                // Add nanogong
6933
                if (api_get_setting('document.enable_nanogong') == 'true') {
6934
6935
                    //@todo pass this as a parameter
6936
                    global $exercise_stat_info, $exerciseId;
6937
6938
                    if (!empty($exercise_stat_info)) {
6939
                        $params = array(
6940
                            'exercise_id' => $exercise_stat_info['exe_exo_id'],
6941
                            'exe_id' => $exercise_stat_info['exe_id'],
6942
                            'question_id' => $questionId
6943
                        );
6944
                    } else {
6945
                        $params = array(
6946
                            'exercise_id' => $exerciseId,
6947
                            'exe_id' => 'temp_exe',
6948
                            'question_id' => $questionId
6949
                        );
6950
                    }
6951
6952
                    $nano = new Nanogong($params);
6953
                    $s .= $nano->show_button();
6954
                }
6955
6956
                $form->addElement('html_editor', "choice[".$questionId."]", null, array('id' => "choice[".$questionId."]"), array('ToolbarSet' => 'TestFreeAnswer'));
6957
                //$form->setDefaults(array("choice[".$questionId."]" => $content));