/** * Displays the menu of question types * @param Exercise $objExercise */ public static function display_type_menu(Exercise $objExercise) { $feedback_type = $objExercise->feedback_type; $exerciseId = $objExercise->id; // 1. by default we show all the question types $question_type_custom_list = self::get_question_type_list(); if (!isset($feedback_type)) { $feedback_type = 0; } if ($feedback_type == 1) { //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available $question_type_custom_list = array(UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER], HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]); } else { unset($question_type_custom_list[HOT_SPOT_DELINEATION]); } echo '<div class="actionsbig">'; echo '<ul class="question_menu">'; $modelType = $objExercise->getModelType(); foreach ($question_type_custom_list as $i => $a_type) { if ($modelType == EXERCISE_MODEL_TYPE_COMMITTEE) { if ($a_type[1] != 'FreeAnswer') { continue; } } // include the class of the type require_once $a_type[0]; // get the picture of the type and the langvar which describes it $img = $explanation = ''; eval('$img = ' . $a_type[1] . '::$typePicture;'); eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); echo '<li>'; echo '<div class="icon_image_content">'; if ($objExercise->exercise_was_added_in_lp == true) { $img = pathinfo($img); $img = $img['filename'] . '_na.' . $img['extension']; echo Display::return_icon($img, $explanation, array(), ICON_SIZE_BIG); } else { echo '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '&exerciseId=' . $exerciseId . '">' . Display::return_icon($img, $explanation, array(), ICON_SIZE_BIG) . '</a>'; } echo '</div>'; echo '</li>'; } echo '<li>'; echo '<div class="icon_image_content">'; if ($objExercise->exercise_was_added_in_lp == true) { echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion')); } else { if ($feedback_type == 1) { //echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&type=1&fromExercise='.$exerciseId.'">'; } else { //echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">'; } echo $url = '<a href="' . api_get_path(WEB_PUBLIC_PATH) . 'courses/' . api_get_course_path() . '/' . api_get_session_id() . '/exercise/' . $exerciseId . '/question-pool">'; echo Display::return_icon('database.png', get_lang('GetExistingQuestion')); } echo '</a>'; echo '</div></li>'; echo '</ul>'; echo '</div>'; }
echo '<div id="question_feedback">' . $comnt . '</div>'; } echo '</div>'; $arrid[] = $questionId; echo '<div id="' . $name . '" style="display:none">'; $feedback_form = new FormValidator('frmcomments' . $questionId, 'post', ''); $feedback_form->addElement('html', '<br>'); $renderer =& $feedback_form->defaultRenderer(); $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); $renderer->setElementTemplate('<div align="left">{element}</div>'); $comnt = get_comments($id, $questionId); $default = array('comments_' . $questionId => $comnt); $feedback_form->addElement('html_editor', 'comments_' . $questionId, null, null, array('ToolbarSet' => 'TestAnswerFeedback', 'Width' => '100%', 'Height' => '120')); $feedback_form->addElement('html', '<br>'); $feedback_form->setDefaults($default); $modelType = $objExercise->getModelType(); if ($modelType == EXERCISE_MODEL_TYPE_COMMITTEE) { //$app['orm']->getRepository() } $feedback_form->display(); echo '</div>'; } else { $comnt = get_comments($id, $questionId); echo '<br />'; if (!empty($comnt)) { echo '<b>' . get_lang('Feedback') . '</b>'; echo '<div id="question_feedback">' . $comnt . '</div>'; } } if ($is_allowedToEdit) { if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {