From 352d8259532c10384d6aa31fc0d76efcd5bbccb0 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Mon, 20 Mar 2023 14:37:56 +0000 Subject: implement PageLayout::disableSidebar() and PageLayout::disableFooter.php, fixes #2395 Closes #2395 Merge request studip/studip!1585 --- lib/classes/PageLayout.php | 52 ++++++++++++++++++++++++++ resources/assets/stylesheets/scss/layouts.scss | 4 ++ templates/footer.php | 2 + templates/layouts/base.php | 6 ++- 4 files changed, 62 insertions(+), 2 deletions(-) diff --git a/lib/classes/PageLayout.php b/lib/classes/PageLayout.php index 64a1d93..3921ef0 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 */ @@ -465,6 +475,48 @@ class PageLayout } /** + * 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 * (except for -). diff --git a/resources/assets/stylesheets/scss/layouts.scss b/resources/assets/stylesheets/scss/layouts.scss index 931fc7b..12176f4 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 d652cb2..164b054 100644 --- a/templates/footer.php +++ b/templates/footer.php @@ -1,3 +1,4 @@ + + render_partial('debug/db-log.php') ?> diff --git a/templates/layouts/base.php b/templates/layouts/base.php index 29a8cd9..2869270 100644 --- a/templates/layouts/base.php +++ b/templates/layouts/base.php @@ -70,13 +70,15 @@ $lang_attr = str_replace('_', '-', $_SESSION['_language']); - +> - render() ?> + + render() ?> +
-- cgit v1.0