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);
?>
';
if ($nbrQuestions) {
//Always getting list from DB
//$questionList = $objExercise->selectQuestionList(true);
$objExercise->setCategoriesGrouping(false);
// Show exercises as in category settings
//$questionList = $objExercise->getQuestionListWithMediasUncompressed();
// Show all questions no matter the category settings.
$tempCategoryOrder = isset($objExercise->specialCategoryOrders) ? $objExercise->specialCategoryOrders : false;
$objExercise->specialCategoryOrders = false;
$questionList = $objExercise->selectQuestionList(true);
$objExercise->specialCategoryOrders = $tempCategoryOrder;
// Style for columns
$styleQuestion = "question";
$styleType = "type";
$styleCat = "category";
$styleLevel = "level";
$styleScore = "score";
$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);
$question_class = get_class($objQuestionTmp);
$clone_link = '
'.
Display::return_icon('cd.png',get_lang('Copy'), array(), ICON_SIZE_SMALL).'';
$edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ?
'
'.Display::return_icon(
'edit_na.png',
get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'),
array(),
ICON_SIZE_SMALL
).'' :
'
'.
Display::return_icon(
'edit.png',
get_lang('Modify'),
array(),
ICON_SIZE_SMALL
).'';
$delete_link = null;
if ($objExercise->edit_exercise_in_lp == true) {
$delete_link = '
'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'';
}
$edit_link = Display::tag('span', $edit_link, array('class'=>'items'));
$clone_link = Display::tag('span', $clone_link, array('class'=>'items'));
$delete_link = Display::tag('span', $delete_link, array('class'=>'items'));
$btnActions = Display::tag('td',Display::tag(
'div',
$edit_link.$clone_link.$delete_link,
array('class'=>'edition')
), array ('class'=>'btn-actions'));
$title = Security::remove_XSS($objQuestionTmp->selectTitle());
/* $move = Display::return_icon(
'all_directions.png',
get_lang('Move'),
array('class'=>'moved', 'style'=>'margin-bottom:-0.3em;')
); */
$move = Display::returnFontAwesomeIcon("arrows moved", 'lg');
// Question name
$questionName = Display::tag(
'td',
'
'.$move.' '.cut($title, 42).'',
array('class' => $styleQuestion)
);
// Question type
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$questionType = Display::tag('td', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_SMALL), array('class'=>$styleType));
// Question category
$txtQuestionCat = Security::remove_XSS(TestCategory::getCategoryNameForQuestion($objQuestionTmp->id));
if (empty($txtQuestionCat)) {
$txtQuestionCat = "-";
}
$questionCategory = Display::tag('td', '
'.
cut($txtQuestionCat, 42).'', array('class'=>$styleCat));
// Question level
$txtQuestionLevel = $objQuestionTmp->level;
if (empty($objQuestionTmp->level)) {
$txtQuestionLevel = '-';
}
$questionLevel = Display::tag('td', $txtQuestionLevel, array('class'=>$styleLevel));
// Question score
$questionScore = Display::tag('td', $objQuestionTmp->selectWeighting(), array('class'=>$styleScore));
echo '
';
echo '';
echo Display::tag(
'div',
null,
['class' => 'question-list-description-block', 'id' => "pnl-question-$id"]
);
echo '
';
unset($objQuestionTmp);
}
}
}
if (!$nbrQuestions) {
echo Display::display_warning_message(get_lang('NoQuestion'));
}
echo '
'; //question list div
}