/** * @param int $questionId * @param int $in_display_category_name * @return null|string */ public static function returnCategoryAndTitle($questionId, $in_display_category_name = 1) { $is_student = !(api_is_allowed_to_edit(null, true) || api_is_session_admin()); $objExercise = Session::read('objExercise'); if (!empty($objExercise)) { $in_display_category_name = $objExercise->display_category_name; } $content = null; if (TestCategory::getCategoryNameForQuestion($questionId) != "" && ($in_display_category_name == 1 || !$is_student)) { $content .= '<div class="page-header">'; $content .= '<h4>' . get_lang('Category') . ": " . TestCategory::getCategoryNameForQuestion($questionId) . '</h4>'; $content .= "</div>"; } return $content; }
if ($objExercise->edit_exercise_in_lp == true) { $delete_link = '<a id="delete_' . $id . '" class="opener" href="' . api_get_self() . '?' . api_get_cidreq() . '&exerciseId=' . $exerciseId . '&deleteQuestion=' . $id . '" >' . Display::return_icon('delete.png', get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL) . '</a>'; } $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', '<a href="#" title = "' . Security::remove_XSS($title) . '">' . $move . ' ' . cut($title, 42) . '</a>', 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', '<a href="#" style="padding:0px; margin:0px;" title="' . $txtQuestionCat . '">' . cut($txtQuestionCat, 42) . '</a>', 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 '<div id="question_id_list_' . $id . '" >'; echo '<div class="header_operations">'; echo $questionName;
/** * Return the name of the category for the question in a course * @author hubert.borderiou 13-10-2011 */ function get_question_categorie_for_question($in_courseid, $in_questionid) { $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid); return $cat; }