Use buttons instead of anchors in exercise submit - refs BT#12444

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago
parent d45b2a57b2
commit a8b5750640
  1. 30
      main/exercise/exercise.class.php
  2. 15
      main/exercise/exercise_submit.php

@ -6962,18 +6962,36 @@ class Exercise
$exercise_actions .= $this->show_button($questionId, $current_question, null, $remindList); $exercise_actions .= $this->show_button($questionId, $current_question, null, $remindList);
break; break;
case ALL_ON_ONE_PAGE: case ALL_ON_ONE_PAGE:
$button = '<a href="javascript://" class="btn" onclick="save_now(\''.$questionId.'\', null, true, 1); ">'.get_lang('SaveForNow').'</a>'; $button = [
$button .= '<span id="save_for_now_'.$questionId.'" class="exercise_save_mini_message"></span>&nbsp;'; Display::button(
$exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button')); 'save_now',
get_lang('SaveForNow'),
['type' => 'button', 'class' => 'btn btn-primary', 'data-question' => $questionId]
),
'<span id="save_for_now_'.$questionId.'" class="exercise_save_mini_message"></span>'
];
$exercise_actions .= Display::div(
implode(PHP_EOL, $button),
array('class'=>'exercise_save_now_button')
);
break; break;
} }
if (!empty($questions_in_media)) { if (!empty($questions_in_media)) {
$count_of_questions_inside_media = count($questions_in_media); $count_of_questions_inside_media = count($questions_in_media);
if ($count_of_questions_inside_media > 1) { if ($count_of_questions_inside_media > 1) {
$button = '<a href="javascript://" class="btn" onclick="save_now(\''.$questionId.'\', false, false, 0); ">'.get_lang('SaveForNow').'</a>'; $button = [
$button .= '<span id="save_for_now_'.$questionId.'" class="exercise_save_mini_message"></span>&nbsp;'; Display::button(
$exercise_actions = Display::div($button, array('class'=>'exercise_save_now_button')); 'save_now',
get_lang('SaveForNow'),
['type' => 'button', 'class' => 'btn btn-primary', 'data-question' => $questionId]
),
'<span id="save_for_now_'.$questionId.'" class="exercise_save_mini_message"></span>&nbsp;'
];
$exercise_actions = Display::div(
implode(PHP_EOL, $button),
array('class'=>'exercise_save_now_button')
);
} }
if ($last_question_in_media && $this->type == ONE_PER_PAGE) { if ($last_question_in_media && $this->type == ONE_PER_PAGE) {

@ -1278,9 +1278,18 @@ if (!empty($error)) {
$exercise_actions .= $objExercise->show_button($questionId, $current_question); $exercise_actions .= $objExercise->show_button($questionId, $current_question);
break; break;
case ALL_ON_ONE_PAGE : case ALL_ON_ONE_PAGE :
$button = '<a href="javascript://" class="btn btn-info" onclick="save_now(\''.$questionId.'\'); ">'.get_lang('SaveForNow').'</a>'; $button = [
$button .= '<span id="save_for_now_'.$questionId.'"></span>&nbsp;'; Display::button(
$exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button')); 'save_now',
get_lang('SaveForNow'),
['type' => 'button', 'class' => 'btn btn-info', 'data-question' => $questionId]
),
'<span id="save_for_now_'.$questionId.'"></span>&nbsp;'
];
$exercise_actions .= Display::div(
implode(PHP_EOL, $button),
array('class'=>'exercise_save_now_button')
);
break; break;
} }

Loading…
Cancel
Save