delete($exerciseId); // if the question has been removed from the exercise if ($objExercise->removeFromList($deleteQuestion)) { $nbrQuestions--; } } // destruction of the Question object unset($objQuestionTmp); } $ajax_url = api_get_path(WEB_AJAX_PATH)."exercise.ajax.php?".api_get_cidreq() ."&exercise_id=".intval($exerciseId); ?>
" style="display:none;">

setQuestionList(); echo '
'; $token = Security::get_token(); //deletes a session when using don't know question type (ugly fix) Session::erase('less_answer'); // If we are in a test $inATest = isset($exerciseId) && $exerciseId > 0; if (!$inATest) { echo "
" .get_lang("ChoiceQuestionType") ."
"; } else { echo '
'; if ($nbrQuestions) { // Always getting list from DB //$questionList = $objExercise->selectQuestionList(true); // In the building exercise mode show question list ordered as is. $objExercise->setCategoriesGrouping(false); // Show exercises as in category settings //$questionList = $objExercise->getQuestionListWithMediasUncompressed(); // In building mode show all questions not render by teacher order. $objExercise->questionSelectionType = EX_Q_SELECTION_ORDERED; // Get question list $questionList = $objExercise->selectQuestionList(true, true); $category_list = TestCategory::getListOfCategoriesNameForTest( $objExercise->id, false ); if (is_array($questionList)) { foreach ($questionList as $id) { //To avoid warning messages if (!is_numeric($id)) { continue; } /** @var Question $objQuestionTmp */ $objQuestionTmp = Question::read($id); $clone_link = Display::url( Display::return_icon( 'cd.png', get_lang('Copy'), [], ICON_SIZE_TINY ), api_get_self().'?'.api_get_cidreq().'&clone_question='.$id, ['class' => 'btn btn-default btn-sm'] ); $edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ? Display::button( 'edit', Display::return_icon( 'edit_na.png', get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'), [], ICON_SIZE_TINY ), ['class' => 'btn btn-default btn-sm'] ) : Display::url( Display::return_icon( 'edit.png', get_lang('Modify'), [], ICON_SIZE_TINY ), api_get_self().'?'.api_get_cidreq().'&' .http_build_query([ 'type' => $objQuestionTmp->selectType(), 'myid' => 1, 'editQuestion' => $id ]), ['class' => 'btn btn-default btn-sm'] ); $delete_link = null; if ($objExercise->edit_exercise_in_lp == true) { $delete_link = Display::url( Display::return_icon( 'delete.png', get_lang('RemoveFromTest'), [], ICON_SIZE_TINY ), api_get_self().'?'.api_get_cidreq() .http_build_query([ 'exerciseId' => $exerciseId, 'deleteQuestion' => $id ]), [ 'id' => "delete_$id", 'class' => 'opener btn btn-default btn-sm' ] ); } $btnActions = implode( PHP_EOL, [$edit_link, $clone_link, $delete_link] ); $title = Security::remove_XSS($objQuestionTmp->selectTitle()); $title = strip_tags($title); $move = Display::returnFontAwesomeIcon("arrows moved", 1, true); // Question name $questionName = ' '.$move.' '.cut($title, 42).' '; // Question type list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html(); $questionType = Display::return_icon($typeImg, $typeExpl); // Question category $txtQuestionCat = Security::remove_XSS( TestCategory::getCategoryNameForQuestion($objQuestionTmp->id) ); if (empty($txtQuestionCat)) { $txtQuestionCat = "-"; } // Question level $txtQuestionLevel = $objQuestionTmp->level; if (empty($objQuestionTmp->level)) { $txtQuestionLevel = '-'; } $questionLevel = $txtQuestionLevel; // Question score $questionScore = $objQuestionTmp->selectWeighting(); echo '
' .$questionName.'
'.get_lang('Type').' ' .$questionType.'
'.get_lang('Category').' ' .cut($txtQuestionCat, 42).'
'.get_lang('Difficulty').' ' .$questionLevel.'
'.get_lang('Score').' ' .$questionScore.'
'.$btnActions.'
'; unset($objQuestionTmp); } } } if (!$nbrQuestions) { echo Display::return_message(get_lang('NoQuestion'), 'warning'); } echo '
'; //question list div }