From 9b2d4e5e57d93ecba56a8cd94398feeb2a7f8e9a Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 17 Feb 2016 09:34:08 -0500 Subject: [PATCH] Display question description collapsed - refs #8078 --- main/exercice/exercise_submit.php | 25 +++++++++++++++++-------- main/inc/lib/display.lib.php | 31 +++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php index d13463a3ff..fd732a7ced 100755 --- a/main/exercice/exercise_submit.php +++ b/main/exercice/exercise_submit.php @@ -738,10 +738,6 @@ if ($time_control) { echo ''; } -if (!empty($objExercise->description)){ - echo Display::panelCollapse(get_lang('ExerciseDescriptionLabel'), $objExercise->description, 'exercise-description', null, 'description', 'exercise-collapse'); -} - if ($origin != 'learnpath') { echo '
'; } @@ -877,6 +873,8 @@ if (!empty($error)) { $(".question-validate-btn").first().trigger("click"); return false; });*/ + + $(\'form#exercise_form\').prepend($(\'#exercise-description\')); }); function previous_question(question_num) { @@ -1156,15 +1154,26 @@ if (!empty($error)) { if ($objExercise->type == ALL_ON_ONE_PAGE) { $exercise_actions = $objExercise->show_button($questionId, $current_question); echo Display::div($exercise_actions, array('class'=>'exercise_actions')); + echo '
'; } echo ''; - echo '
'; + + if (!empty($objExercise->description)){ + echo Display::panelCollapse( + get_lang('ExerciseDescriptionLabel'), + $objExercise->description, + 'exercise-description', + [], + 'description', + 'exercise-collapse', + false + ); + } } if ($origin != 'learnpath') { // So we are not in learnpath tool echo ''; //End glossary div - Display :: display_footer(); -} else { - echo ''; } + +Display :: display_footer(); diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 077449524c..e49aea8e52 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2259,16 +2259,27 @@ class Display $arrow = false ) { if (!empty($idAccordion)) { - $html = null; - $html .= '
' . PHP_EOL; - $html .= '
' . PHP_EOL; - $html .= '' . PHP_EOL; - $html .= '
' . PHP_EOL; - $html .= '
'.$content.'
' . PHP_EOL; - $html .= '
' . PHP_EOL; - + $headerClass = ''; + $headerClass .= $arrow ? 'arrow ' : ''; + $headerClass .= $open ? '' : 'collapsed'; + $contentClass = 'panel-collapse collapse '; + $contentClass .= $open ? 'in' : ''; + $ariaExpanded = $open ? 'true' : 'false'; + + $html = << +
+ +
+
$content
+
+
+ +HTML; } else { if (!empty($id)) { $params['id'] = $id;