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);
// Style for columns
$styleQuestion = "width:50%; float:left; margin-left: 25px;";
$styleType = "width:4%; float:left; text-align:center;";
$styleCat = "width:22%; float:left; text-align:center;";
$styleLevel = "width:6%; float:left; text-align:center;";
$styleScore = "width:4%; float:left; text-align:center;";
if (is_array($questionList)) {
foreach ($questionList as $id) {
//To avoid warning messages
if (!is_numeric($id)) {
continue;
}
$objQuestionTmp = Question::read($id);
$question_class = get_class($objQuestionTmp);
$clone_link = '
'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'';
/*$edit_link = '
'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'';
if ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) {
$edit_link = '
'.Display::return_icon('edit_na.png',get_lang('Modify'), 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('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
$clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
$delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
$actions = Display::tag(
'div',
$edit_link.$clone_link.$delete_link,
array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;')
);
$title = Security::remove_XSS($objQuestionTmp->selectTitle());
$move = Display::return_icon(
'all_directions.png',
get_lang('Move'),
array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;')
);
// Question name
$questionName = Display::tag(
'div',
'
'.$move.' '.cut($title, 42).'',
array('style' => $styleQuestion)
);
// Question type
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM), array('style'=>$styleType));
// Question category
$txtQuestionCat = Security::remove_XSS(TestCategory::getCategoryNameForQuestion($objQuestionTmp->id));
if (empty($txtQuestionCat)) {
$txtQuestionCat = "-";
}
$questionCategory = Display::tag('div', '
'.
cut($txtQuestionCat, 42).'', array('style'=>$styleCat));
// Question level
$txtQuestionLevel = $objQuestionTmp->level;
if (empty($objQuestionTmp->level)) {
$txtQuestionLevel = '-';
}
$questionLevel = Display::tag('div', $txtQuestionLevel, array('style'=>$styleLevel));
// Question score
$questionScore = Display::tag('div', $objQuestionTmp->selectWeighting(), array('style'=>$styleScore));
echo '
';
echo '';
echo '
';
echo '
';
//echo get_lang($question_class.$label);
echo get_lang($question_class);
echo '
';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
echo '
';
ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
echo '
';
echo '
';
echo '
';
unset($objQuestionTmp);
}
}
}
if (!$nbrQuestions) {
echo Display::display_warning_message(get_lang('NoQuestion'));
}
echo '
'; //question list div
}