diff --git a/lib/classes/PageLayout.php b/lib/classes/PageLayout.php index 64a1d935902c98411de7ee6fc8ebd8837469aa76..3921ef008d63ac9e39163b71d3eddbeff775122d 100644 --- a/lib/classes/PageLayout.php +++ b/lib/classes/PageLayout.php @@ -65,6 +65,16 @@ class PageLayout */ private static $display_header = true; + /** + * determines whether the sidebar is displayed or not + */ + private static $display_sidebar = true; + + /** + * determines whether the page footer is displayed or not + */ + private static $display_footer = true; + /* * Custom quicksearch on the page */ @@ -464,6 +474,48 @@ class PageLayout return self::$display_header && empty($GLOBALS['_NOHEADER']); } + /** + * Disable output of the sidebar for this page. + * + * @since Stud.IP 5.4 + */ + public static function disableSidebar(bool $state = true) + { + self::$display_sidebar = !$state; + } + + /** + * Return whether output of the sidebar is enabled. + * + * @since Stud.IP 5.4 + */ + public static function isSidebarEnabled(): bool + { + return self::$display_sidebar; + } + + /** + * Disable output of the page footer for this page. + * + * @param bool $state + * + * @since Stud.IP 5.4 + */ + public static function disableFooter(bool $state = true) + { + self::$display_footer = !$state; + } + + /** + * Return whether output of the page footer is enabled. + * + * @since Stud.IP 5.4 + */ + public static function isFooterEnabled(): bool + { + return self::$display_footer; + } + /** * Sets the id of the html body element. * The given id is stripped of all non alpha-numeric characters diff --git a/resources/assets/stylesheets/scss/layouts.scss b/resources/assets/stylesheets/scss/layouts.scss index 931fc7b1c89c90a791a579f1e75aa6341fef7ae5..12176f484e9967c41caa2e414886afe5530b34fa 100644 --- a/resources/assets/stylesheets/scss/layouts.scss +++ b/resources/assets/stylesheets/scss/layouts.scss @@ -167,6 +167,10 @@ body { .oversized & { overflow: visible; } + + .no-sidebar & { + grid-column: 1 / 3; + } } #content { diff --git a/templates/footer.php b/templates/footer.php index d652cb2a060fe34b09c28e1d408fa7a923db50b0..164b054cfffe87961b133b04c87214371956dd91 100644 --- a/templates/footer.php +++ b/templates/footer.php @@ -1,3 +1,4 @@ +<? if (PageLayout::isFooterEnabled()): ?> <!-- Beginn Footer --> <?= SkipLinks::addIndex(_('Fußzeile'), 'main-footer', 900, false) ?> <footer id="main-footer" aria-label="<?= _('Fußzeile') ?>"> @@ -55,5 +56,6 @@ </nav> <? endif; ?> </footer> +<? endif; ?> <?= $this->render_partial('debug/db-log.php') ?> <!-- Ende Footer --> diff --git a/templates/layouts/base.php b/templates/layouts/base.php index 29a8cd9fe0a69f890ca1efb9f1aba70808f7be92..2869270fd51ef44883151a09a779ee8ed9abe4c0 100644 --- a/templates/layouts/base.php +++ b/templates/layouts/base.php @@ -70,13 +70,15 @@ $lang_attr = str_replace('_', '-', $_SESSION['_language']); </script> </head> -<body id="<?= PageLayout::getBodyElementId() ?>"> +<body id="<?= PageLayout::getBodyElementId() ?>" <? if (!PageLayout::isSidebarEnabled()) echo 'class="no-sidebar"'; ?>> <div id="skip_link_navigation" aria-busy="true"></div> <?= PageLayout::getBodyElements() ?> <? include 'lib/include/header.php' ?> - <?= Sidebar::get()->render() ?> + <? if (PageLayout::isSidebarEnabled()): ?> + <?= Sidebar::get()->render() ?> + <? endif; ?> <!-- Start main page content --> <main id="content-wrapper">