diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/PageLayout.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/PageLayout.php')
| -rw-r--r-- | lib/classes/PageLayout.php | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/lib/classes/PageLayout.php b/lib/classes/PageLayout.php index fca69b5..7f95b7a 100644 --- a/lib/classes/PageLayout.php +++ b/lib/classes/PageLayout.php @@ -36,6 +36,11 @@ class PageLayout private static $help_keyword; /** + * current help URL (or null if unset) + */ + private static ?string $help_url = null; + + /** * base item path for tab view (defaults to active item in top nav) */ private static $tab_navigation_path = false; @@ -134,6 +139,21 @@ class PageLayout self::addScript('studip-wysiwyg.js?v=' . $v); self::addStylesheet('print.css?v=' . $v, ['media' => 'print']); + + if (Studip\Debug\DebugBar::isActivated()) { + $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); + + self::addHeadElement('link', [ + 'href' => URLHelper::getURL('dispatch.php/debugbar/css'), + 'rel' => 'stylesheet', + 'type' => 'text/css', + ]); + self::addHeadElement('script', [ + 'src' => URLHelper::getURL('dispatch.php/debugbar/js'), + ], ''); + + URLHelper::setBaseURL($old_base); + } } /** @@ -179,7 +199,24 @@ class PageLayout */ public static function getHelpKeyword() { - return isset(self::$help_keyword) ? self::$help_keyword : 'Basis.Allgemeines'; + return self::$help_keyword ?? 'Basis.Allgemeines'; + } + + /** + * Set the help URL in the help bar. Pass null to fall back to the help keyword. + */ + public static function setHelpUrl(?string $url): void + { + self::$help_url = $url; + } + + /** + * Get the current help URL. If no URL is set explicitly, the URL for + * the help keyword is used. + */ + public static function getHelpUrl(): ?string + { + return self::$help_url ?? format_help_url(self::getHelpKeyword()); } /** @@ -562,10 +599,18 @@ class PageLayout if (!isset($_SESSION['messages'])) { $_SESSION['messages'] = []; } + + $structure = [ + 'type' => $message->class, + 'message' => $message->message, + 'details' => $message->details, + 'closeable' => $message->isCloseable() + ]; + if ($id === null ) { - $_SESSION['messages'][] = $message; + $_SESSION['messages'][] = $structure; } else { - $_SESSION['messages'][$id] = $message; + $_SESSION['messages'][$id] = $structure; } } |
