Adding exercise description accordion see #3845

skala
Julio Montoya 13 years ago
parent baf31f0102
commit de0956f641
  1. 1
      main/css/base.css
  2. 9
      main/exercice/exercise_submit.php
  3. 4
      main/exercice/overview.php
  4. 30
      main/inc/lib/display.lib.php
  5. 10
      main/template/default/layout/head.tpl

@ -2491,6 +2491,7 @@ div.admin_section h4 {
.exercise_description {
padding:0px 0px 10px 0px;
border-bottom: 1px solid #CCCCCC;
}
.exercise_title {
font-size: 1.6em;

@ -673,6 +673,11 @@ if ($time_control) {
echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciceExpiredTimeMessage').'</div>';
}
//echo Display::div($objExercise->description, array('id'=> 'exercise_description', 'class'=>'exercise_description'));
if (!empty($objExercise->description)) {
echo Display::generate_accordion(array( array('title' => get_lang('ExerciseDescription'), 'content' => $objExercise->description)));
}
if ($origin != 'learnpath') {
echo '<div id="highlight-plugin" class="glossary-content">';
}
@ -789,7 +794,6 @@ if (!empty($error)) {
$(".no_remind_highlight").hide();
});
function previous_question(question_num) {
url = "exercise_submit.php?'.$params.'&num="+question_num;
window.location = url;
@ -799,8 +803,7 @@ if (!empty($error)) {
url = "exercise_submit.php?'.$params.'&num="+previous_question_id;
//Save the current question
save_now(question_id_to_save, url);
}
}
function save_now(question_id, url_extra) {
//1. Normal choice inputs

@ -82,7 +82,9 @@ if ($is_allowed_to_edit ) {
$html .= Display::page_header( $objExercise->name.' '.$edit_link);
//Exercise description
$html .= Display::div($objExercise->description, array('class'=>'exercise_description'));
if (!empty($objExercise->description)) {
$html .= Display::div($objExercise->description, array('class'=>'exercise_description'));
}
$extra_params = '';
if (isset($_GET['preview'])) {

@ -1493,4 +1493,34 @@ class Display {
}
return self::span($text, array('class' => 'boot-tooltip', 'title' => strip_tags($tip)));
}
public static function generate_accordion($items) {
$html = null;
if (!empty($items)) {
$id = api_get_unique_id();
//$html = '<div class="accordion" id="'.$id.'">'; //using bootstrap
$html = '<div class="accordion_jquery" id="'.$id.'">'; //using jquery
$count = 1;
foreach ($items as $item) {
$html .= '<div class="accordion-my-group">';
$html .= '<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#'.$id.'" href="#collapse'.$count.'">
'.$item['title'].'
</a>
</div>';
//$html .= '<div id="collapse'.$count.'" class="accordion-body collapse in">
$html .= '<div id="collapse'.$count.'" class="accordion-body">';
//$html .= '<div class="accordion-inner">
$html .= '<div class="accordion-my-inner">
'.$item['content'].'
</div>
</div>';
}
$html .= '</div>';
}
return $html;
}
} //end class Display

@ -224,6 +224,16 @@ $(function() {
//Responsive effect
$(".collapse").collapse();
//$('#collapse1').collapse("hide");
$(".accordion_jquery").accordion({
autoHeight: false,
active: false, // all items closed by default
collapsible: true,
header: ".accordion-heading",
})
//Global popup
$('.ajax').on('click', function() {

Loading…
Cancel
Save