noheader value in origin variable to hide headers

pull/3419/head
Nosolored 5 years ago
parent 341a9b979f
commit 8e506f0dee
  1. 2
      main/exercise/exercise.php
  2. 6
      main/exercise/exercise_result.php
  3. 9
      main/exercise/exercise_submit.php
  4. 9
      main/exercise/overview.php
  5. 9
      main/exercise/result.php
  6. 6
      main/inc/lib/display.lib.php

@ -506,7 +506,7 @@ if ($is_allowedToEdit) {
}
}
if ($origin !== 'learnpath') {
if (!in_array($origin, ['learnpath', 'noheader'])) {
//so we are not in learnpath tool
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message']) && in_array($_GET['message'], ['ExerciseEdited'])) {

@ -89,7 +89,7 @@ $pageTop = '';
$pageBottom = '';
$pageContent = '';
if (!in_array($origin, ['learnpath', 'embeddable'])) {
if (!in_array($origin, ['learnpath', 'embeddable', 'noheader'])) {
// So we are not in learnpath tool
$showHeader = true;
}
@ -240,7 +240,7 @@ ExerciseLib::exercise_time_control_delete(
ExerciseLib::delete_chat_exercise_session($exe_id);
if (!in_array($origin, ['learnpath', 'embeddable'])) {
if (!in_array($origin, ['learnpath', 'embeddable', 'noheader'])) {
$pageBottom .= '<div class="question-return">';
$pageBottom .= Display::url(
get_lang('ReturnToCourseHomepage'),
@ -254,7 +254,7 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
}
$showFooter = true;
} elseif ($origin === 'embeddable') {
} elseif (in_array($origin, ['embeddable', 'noheader'])) {
if (api_is_allowed_to_session_edit()) {
Exercise::cleanSessionVariables();
}

@ -879,7 +879,7 @@ $interbreadcrumb[] = [
];
$interbreadcrumb[] = ['url' => '#', 'name' => $objExercise->selectTitle(true)];
if (!in_array($origin, ['learnpath', 'embeddable'])) { //so we are not in learnpath tool
if (!in_array($origin, ['learnpath', 'embeddable', 'noheader'])) { //so we are not in learnpath tool
if (!api_is_allowed_to_session_edit()) {
Display::addFlash(
Display::return_message(get_lang('SessionIsReadOnly'), 'warning')
@ -892,6 +892,13 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) { //so we are not in learnp
echo '<div style="height:10px">&nbsp;</div>';
}
if ($origin == 'noheader') {
echo '<div class="actions">';
echo '<a href="javascript:window.history.go(-1);">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'), [], 32).'</a>';
echo '</div>';
}
$show_quiz_edition = $objExercise->added_in_lp();
// I'm in a preview mode

@ -71,7 +71,7 @@ if ($time_control) {
$htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left);
}
if (!in_array($origin, ['learnpath', 'embeddable'])) {
if (!in_array($origin, ['learnpath', 'embeddable', 'noheader'])) {
Display::display_header();
} else {
$htmlHeadXtra[] = "
@ -82,6 +82,13 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
Display::display_reduced_header();
}
if ($origin == 'noheader') {
echo '<div class="actions">';
echo '<a href="javascript:window.history.go(-1);">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'), [], 32).'</a>';
echo '</div>';
}
$html = '';
$message = '';
$html .= '<div class="exercise-overview">';

@ -15,7 +15,7 @@ $id = isset($_REQUEST['id']) ? (int) $_GET['id'] : 0; // exe id
$show_headers = isset($_REQUEST['show_headers']) ? (int) $_REQUEST['show_headers'] : null;
$origin = api_get_origin();
if (in_array($origin, ['learnpath', 'embeddable'])) {
if (in_array($origin, ['learnpath', 'embeddable', 'noheader'])) {
$show_headers = false;
}
@ -77,6 +77,13 @@ if ($show_headers) {
$htmlHeadXtra[] = '<style>
body { background: none;}
</style>';
if ($origin == 'noheader') {
echo '<div class="actions">';
echo '<a href="javascript:window.history.go(-1);">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'), [], 32).'</a>';
echo '</div>';
}
}
$message = Session::read('attempt_remaining');

@ -64,7 +64,11 @@ class Display
) {
$origin = api_get_origin();
$showHeader = true;
if (isset($origin) && $origin == 'learnpath') {
if (isset($origin) && ($origin == 'learnpath' || $origin == 'noheader')) {
$showHeader = false;
}
if (Session::read('origin') == 'noheader') {
$showHeader = false;
}

Loading…
Cancel
Save