Minor - Format code - refs BT#17549

pull/3388/head
Angel Fernando Quiroz Campos 5 years ago
parent aacdbc8e31
commit b22b99fce0
  1. 178
      main/exercise/exercise.class.php

@ -3226,118 +3226,114 @@ class Exercise
$params['class'] .= ' no-header ';
}
$html .= Display::url(
$urlTitle,
$url,
$params
);
$html .= Display::url($urlTitle, $url, $params);
$html .= '<br />';
} else {
// User
if (api_is_allowed_to_session_edit()) {
$endReminderValue = false;
if (!empty($myRemindList)) {
$endValue = end($myRemindList);
if ($endValue == $question_id) {
$endReminderValue = true;
}
return $html;
}
// User
if (api_is_allowed_to_session_edit()) {
$endReminderValue = false;
if (!empty($myRemindList)) {
$endValue = end($myRemindList);
if ($endValue == $question_id) {
$endReminderValue = true;
}
if ($this->type == ALL_ON_ONE_PAGE || $nbrQuestions == $questionNum || $endReminderValue) {
if ($this->review_answers) {
$label = get_lang('ReviewQuestions');
$class = 'btn btn-success';
} else {
$label = get_lang('EndTest');
$class = 'btn btn-warning';
}
}
if ($this->type == ALL_ON_ONE_PAGE || $nbrQuestions == $questionNum || $endReminderValue) {
if ($this->review_answers) {
$label = get_lang('ReviewQuestions');
$class = 'btn btn-success';
} else {
$label = get_lang('NextQuestion');
$class = 'btn btn-primary';
$label = get_lang('EndTest');
$class = 'btn btn-warning';
}
// used to select it with jquery
$class .= ' question-validate-btn';
if ($this->type == ONE_PER_PAGE) {
if ($questionNum != 1) {
if ($this->showPreviousButton()) {
$prev_question = $questionNum - 2;
$showPreview = true;
if (!empty($myRemindList)) {
$beforeId = null;
for ($i = 0; $i < count($myRemindList); $i++) {
if (isset($myRemindList[$i]) && $myRemindList[$i] == $question_id) {
$beforeId = isset($myRemindList[$i - 1]) ? $myRemindList[$i - 1] : null;
break;
}
}
if (empty($beforeId)) {
$showPreview = false;
} else {
$num = 0;
foreach ($this->questionList as $originalQuestionId) {
if ($originalQuestionId == $beforeId) {
break;
}
$num++;
}
$prev_question = $num;
}
} else {
$label = get_lang('NextQuestion');
$class = 'btn btn-primary';
}
// used to select it with jquery
$class .= ' question-validate-btn';
if ($this->type == ONE_PER_PAGE) {
if ($questionNum != 1 && $this->showPreviousButton()) {
$prev_question = $questionNum - 2;
$showPreview = true;
if (!empty($myRemindList)) {
$beforeId = null;
for ($i = 0; $i < count($myRemindList); $i++) {
if (isset($myRemindList[$i]) && $myRemindList[$i] == $question_id) {
$beforeId = isset($myRemindList[$i - 1]) ? $myRemindList[$i - 1] : null;
break;
}
}
if ($showPreview && 0 === $this->getPreventBackwards()) {
$buttonList[] = Display::button(
'previous_question_and_save',
get_lang('PreviousQuestion'),
[
'type' => 'button',
'class' => 'btn btn-default',
'data-prev' => $prev_question,
'data-question' => $question_id,
]
);
if (empty($beforeId)) {
$showPreview = false;
} else {
$num = 0;
foreach ($this->questionList as $originalQuestionId) {
if ($originalQuestionId == $beforeId) {
break;
}
$num++;
}
$prev_question = $num;
}
}
// Next question
if (!empty($questions_in_media)) {
if ($showPreview && 0 === $this->getPreventBackwards()) {
$buttonList[] = Display::button(
'save_question_list',
$label,
'previous_question_and_save',
get_lang('PreviousQuestion'),
[
'type' => 'button',
'class' => $class,
'data-list' => implode(",", $questions_in_media),
'class' => 'btn btn-default',
'data-prev' => $prev_question,
'data-question' => $question_id,
]
);
} else {
$buttonList[] = Display::button(
'save_now',
$label,
['type' => 'button', 'class' => $class, 'data-question' => $question_id]
);
}
$buttonList[] = '<span id="save_for_now_'.$question_id.'" class="exercise_save_mini_message"></span>&nbsp;';
}
$html .= implode(PHP_EOL, $buttonList);
// Next question
if (!empty($questions_in_media)) {
$buttonList[] = Display::button(
'save_question_list',
$label,
[
'type' => 'button',
'class' => $class,
'data-list' => implode(",", $questions_in_media),
]
);
} else {
if ($this->review_answers) {
$all_label = get_lang('ReviewQuestions');
$class = 'btn btn-success';
} else {
$all_label = get_lang('EndTest');
$class = 'btn btn-warning';
}
// used to select it with jquery
$class .= ' question-validate-btn';
$buttonList[] = Display::button(
'validate_all',
$all_label,
['type' => 'button', 'class' => $class]
'save_now',
$label,
['type' => 'button', 'class' => $class, 'data-question' => $question_id]
);
$buttonList[] = '&nbsp;'.Display::span(null, ['id' => 'save_all_response']);
$html .= implode(PHP_EOL, $buttonList);
}
$buttonList[] = '<span id="save_for_now_'.$question_id.'" class="exercise_save_mini_message"></span>';
$html .= implode(PHP_EOL, $buttonList).PHP_EOL;
} else {
if ($this->review_answers) {
$all_label = get_lang('ReviewQuestions');
$class = 'btn btn-success';
} else {
$all_label = get_lang('EndTest');
$class = 'btn btn-warning';
}
// used to select it with jquery
$class .= ' question-validate-btn';
$buttonList[] = Display::button(
'validate_all',
$all_label,
['type' => 'button', 'class' => $class]
);
$buttonList[] = Display::span(null, ['id' => 'save_all_response']);
$html .= implode(PHP_EOL, $buttonList).PHP_EOL;
}
}

Loading…
Cancel
Save