aboutsummaryrefslogtreecommitdiff
path: root/lib/include
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /lib/include
current code from svn, revision 62608
Diffstat (limited to 'lib/include')
-rw-r--r--lib/include/header.php61
-rw-r--r--lib/include/html_end.inc.php11
-rw-r--r--lib/include/html_head.inc.php75
3 files changed, 147 insertions, 0 deletions
diff --git a/lib/include/header.php b/lib/include/header.php
new file mode 100644
index 0000000..5a90479
--- /dev/null
+++ b/lib/include/header.php
@@ -0,0 +1,61 @@
+<?php
+# Lifter002: TODO
+# Lifter007: TODO
+# Lifter003: TODO
+# Lifter010: TODO
+/**
+ * head line of Stud.IP
+ *
+ * @author Stefan Suchi <suchi@data-quest.de>
+ * @author Michael Riehemann <michael.riehemann@uni-oldenburg.de>
+ * @author Ralf Stockmann <rstockm@gwdg.de>
+ * @license GPL2 or any later version
+ * @access public
+ * @modulegroup visual
+ * @module header.php
+ * @package studip_core
+ */
+
+/* ---
+ * Mögliche Datenschutz-/Sichtbarkeitsentscheidung: Beim ersten Login wird ein
+ * informierender Text mit Entscheidungsmöglichkeit: "Ich will sichtbar sein" oder
+ * "Ich will unsichtbar sein" angezeigt.
+ *
+ * Bei Nutzung dieser Funktion unbedingt die Texte unter locale/de/LC_HELP/visibility_decision.php bzw.
+ * locale/en/LC_HELP/visibility_decision.php an die lokalen Verhältnisse anpassen!
+ */
+if (PageLayout::isHeaderEnabled()) //Einige Seiten benötigen keinen Header, sprich Navigation (Evaluation usw.)
+{
+ $header_template = $GLOBALS['template_factory']->open('header');
+ $header_template->current_page = PageLayout::getTitle();
+ $header_template->link_params = array_fill_keys(array_keys(URLHelper::getLinkParams()), NULL);
+
+ if (is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
+ // only mark course if user is logged in and free access enabled
+ $is_public_course = Context::isCourse() && Config::get()->ENABLE_FREE_ACCESS;
+ $is_public_institute = Context::isInstitute()
+ && Config::get()->ENABLE_FREE_ACCESS
+ && Config::get()->ENABLE_FREE_ACCESS != 'courses_only';
+ if (($is_public_course || $is_public_institute) &&
+ Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive()) {
+ // indicate to the template that this course is publicly visible
+ // need to handle institutes separately (always visible)
+ if (Context::isInstitute()) {
+ $header_template->public_hint = _('öffentliche Einrichtung');
+ } else if (Course::findCurrent()->lesezugriff == 0) {
+ $header_template->public_hint = _('öffentliche Veranstaltung');
+ }
+ }
+ if ($GLOBALS['user']->cfg->ACCESSKEY_ENABLE) {
+ $header_template->accesskey_enabled = true;
+ }
+
+ if (!$GLOBALS['user']->needsToAcceptTerms()) {
+ $header_template->show_quicksearch = true;
+ }
+ }
+} else {
+ $header_template = $GLOBALS['template_factory']->open('noheader');
+}
+
+echo $header_template->render();
diff --git a/lib/include/html_end.inc.php b/lib/include/html_end.inc.php
new file mode 100644
index 0000000..24f935d
--- /dev/null
+++ b/lib/include/html_end.inc.php
@@ -0,0 +1,11 @@
+ </div>
+ </div>
+ </div>
+ <?= $GLOBALS['template_factory']->render('footer') ?>
+<!-- Ende Page -->
+</div>
+
+ <?= SkipLinks::getHTML() ?>
+
+</body>
+</html>
diff --git a/lib/include/html_head.inc.php b/lib/include/html_head.inc.php
new file mode 100644
index 0000000..2991ba7
--- /dev/null
+++ b/lib/include/html_head.inc.php
@@ -0,0 +1,75 @@
+<?php
+/**
+* output of html-head for all Stud.IP pages
+*
+* @author Stefan Suchi <suchi@data-quest.de>
+* @license GPL2 or any later version
+*/
+
+$getInstalledLanguages = function () {
+ $languages = [];
+ foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $key => $value) {
+ $languages[$key] = array_merge(
+ $value,
+ ['selected' => $_SESSION['_language'] === $key]
+ );
+ }
+
+ return $languages;
+};
+?>
+<!DOCTYPE html>
+<html class="no-js">
+<head>
+ <meta charset="utf-8">
+ <title data-original="<?= htmlReady(PageLayout::getTitle()) ?>">
+ <?= htmlReady(PageLayout::getTitle() . ' - ' . Config::get()->UNI_NAME_CLEAN) ?>
+ </title>
+ <script>
+ CKEDITOR_BASEPATH = "<?= Assets::url('javascripts/ckeditor/') ?>";
+ String.locale = "<?= htmlReady(strtr($_SESSION['_language'], '_', '-')) ?>";
+
+ document.querySelector('html').className = 'js';
+ setTimeout(() => {
+ // This needs to be put in a timeout since otherwise it will not match
+ if (window.matchMedia('(max-width: 767px)').matches) {
+ document.querySelector('html').classList.add('responsive-display');
+ }
+ }, 0);
+
+ window.STUDIP = {
+ ABSOLUTE_URI_STUDIP: "<?= $GLOBALS['ABSOLUTE_URI_STUDIP'] ?>",
+ ASSETS_URL: "<?= $GLOBALS['ASSETS_URL'] ?>",
+ CSRF_TOKEN: {
+ name: '<?=CSRFProtection::TOKEN?>',
+ value: '<? try {echo CSRFProtection::token();} catch (SessionRequiredException $e){}?>'
+ },
+ INSTALLED_LANGUAGES: <?= json_encode($getInstalledLanguages()) ?>,
+ STUDIP_SHORT_NAME: "<?= htmlReady(Config::get()->STUDIP_SHORT_NAME) ?>",
+ URLHelper: {
+ base_url: "<?= $GLOBALS['ABSOLUTE_URI_STUDIP'] ?>",
+ parameters: <?= json_encode(URLHelper::getLinkParams(), JSON_FORCE_OBJECT) ?>
+ },
+ jsupdate_enable: <?= json_encode(
+ is_object($GLOBALS['perm']) &&
+ $GLOBALS['perm']->have_perm('autor') &&
+ PersonalNotifications::isActivated()) ?>,
+ wysiwyg_enabled: <?= json_encode((bool) Config::get()->WYSIWYG) ?>
+ }
+ </script>
+<? if ($_SESSION['_language'] !== 'de_DE'): ?>
+ <link rel="localization" hreflang="<?= htmlReady(strtr($_SESSION['_language'], '_', '-')) ?>"
+ href="<?= URLHelper::getScriptLink('dispatch.php/localizations/' . $_SESSION['_language']) ?>" type="application/vnd.oftn.l10n+json">
+<? endif ?>
+
+ <?= PageLayout::getHeadElements() ?>
+
+ <script>
+ window.STUDIP.editor_enabled = <?= json_encode((bool) Studip\Markup::editorEnabled()) ?> && CKEDITOR.env.isCompatible;
+ </script>
+</head>
+
+<body id="<?= PageLayout::getBodyElementId() ?>">
+<div id="layout_wrapper">
+ <? SkipLinks::insertContainer() ?>
+ <?= PageLayout::getBodyElements() ?>