Newer
Older
<?php
# Lifter010: TODO
$nav_items = Navigation::getItem('/')->getIterator()->getArrayCopy();
$nav_items = array_filter($nav_items, function ($item) {
return $item->isVisible(true);
});
$header_nav = ['visible' => $nav_items, 'hidden' => []];
if (isset($_COOKIE['navigation-length'])) {
$header_nav['hidden'] = array_splice(
$header_nav['visible'],
$_COOKIE['navigation-length']
);
}
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$navigation = PageLayout::getTabNavigation();
$tab_root_path = PageLayout::getTabNavigationPath();
if ($navigation) {
$subnavigation = $navigation->activeSubNavigation();
if ($subnavigation !== null) {
$nav_links = new NavigationWidget();
$nav_links->setId('sidebar-navigation');
$nav_links->addCSSClass('navigation-level-3');
$nav_links->setTitle(_('Dritte Navigationsebene'));
if (!$navigation->getImage()) {
$nav_links->addLayoutCSSClass('show');
}
foreach ($subnavigation as $path => $nav) {
if (!$nav->isVisible()) {
continue;
}
$nav_id = "nav_".implode("_", preg_split("/\//", $tab_root_path, -1, PREG_SPLIT_NO_EMPTY))."_".$path;
$link = $nav_links->addLink(
$nav->getTitle(),
URLHelper::getURL($nav->getURL()),
null,
array_merge($nav->getLinkAttributes(), ['id' => $nav_id])
);
$link->setActive($nav->isActive());
if (!$nav->isEnabled()) {
$link['disabled'] = true;
$link->addClass('quiet');
}
}
if ($nav_links->hasElements()) {
Sidebar::get()->insertWidget($nav_links, ':first');
}
}
}
<? SkipLinks::insertContainer() ?>
<?= PageLayout::getBodyElements() ?>
<!-- Begin main site header -->
<header id="main-header">
<!-- Top bar with site title, quick search and avatar menu -->
<div id="top-bar" role="banner">
<div id="responsive-menu">
<input type="checkbox" id="barTopMenu-toggle">
<label for="barTopMenu-toggle">
<?= _('Menü') ?>
</label>
<? // The main menu will be placed here when scrolled, see navigation.less ?>
</div>
<div id="site-title">
<?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?>
</div>
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!-- Dynamische Links ohne Icons -->
<div id="header-links">
<ul>
<? if (Navigation::hasItem('/links')): ?>
<? foreach (Navigation::getItem('/links') as $nav): ?>
<? if ($nav->isVisible()) : ?>
<li class="<? if ($nav->isActive()) echo 'active'; ?> <?= htmlReady($nav->getLinkAttributes()['class'] ?? '') ?>">
<a
<? if (is_internal_url($url = $nav->getURL())) : ?>
href="<?= URLHelper::getLink($url) ?>"
<? else: ?>
href="<?= htmlReady($url) ?>" target="_blank" rel="noopener noreferrer"
<? endif; ?>
<? if ($nav->getDescription()): ?>
title="<?= htmlReady($nav->getDescription()) ?>"
<? endif; ?>
<?= arrayToHtmlAttributes(array_diff_key($nav->getLinkAttributes(), array_flip(['class', 'title']))) ?>
><?= htmlReady($nav->getTitle()) ?></a>
</li>
<? endif; ?>
<? endforeach; ?>
<? endif; ?>
<? if (isset($show_quicksearch)) : ?>
<? if (PageLayout::hasCustomQuicksearch()): ?>
<?= PageLayout::getCustomQuicksearch() ?>
<? else: ?>
<? SkipLinks::addIndex(_('Suche'), 'globalsearch-input', 910) ?>
<li id="quicksearch_item">
<script>
var selectSem = function (seminar_id, name) {
document.location = "<?= URLHelper::getURL("dispatch.php/course/details/", ["send_from_search" => 1, "send_from_search_page" => URLHelper::getURL("dispatch.php/search/courses?keep_result_set=1")]) ?>&sem_id=" + seminar_id;
};
</script>
<?= $GLOBALS['template_factory']->render('globalsearch/searchbar') ?>
</li>
<? endif; ?>
<? endif; ?>
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<? if (is_object($GLOBALS['perm']) && $GLOBALS['perm']->have_perm('user')): ?>
<? $active = Navigation::hasItem('/profile')
&& Navigation::getItem('/profile')->isActive();
?>
<!-- User-Avatar -->
<li class="header_avatar_container <? if ($active) echo 'active'; ?>" id="avatar-menu-container">
<? if (is_object($GLOBALS['perm']) && PersonalNotifications::isActivated() && $GLOBALS['perm']->have_perm('autor')) : ?>
<? $notifications = PersonalNotifications::getMyNotifications() ?>
<? $lastvisit = (int)UserConfig::get($GLOBALS['user']->id)->getValue('NOTIFICATIONS_SEEN_LAST_DATE') ?>
<div id="notification-container"<?= count($notifications) > 0 ? ' class="hoverable"' : '' ?>>
<? foreach ($notifications as $notification) {
if ($notification['mkdate'] > $lastvisit) {
$alert = true;
}
} ?>
<button id="notification_marker" data-toggles="#notification_checkbox" <?= !empty($alert) ? ' class="alert"' : "" ?>
title="<?= sprintf(
ngettext('%u Benachrichtigung', '%u Benachrichtigungen', count($notifications)),
count($notifications)
) ?>" data-lastvisit="<?= $lastvisit ?>"
<?= count($notifications) == 0 ? 'disabled' : '' ?>>
<span class="count" aria-hidden="true"><?= count($notifications) ?></span>
</button>
<input type="checkbox" id="notification_checkbox">
<div class="list below" id="notification_list">
<a class="mark-all-as-read <? if (count($notifications) < 2) echo 'invisible'; ?>" href="<?= URLHelper::getLink('dispatch.php/jsupdater/mark_notification_read/all', ['return_to' => $_SERVER['REQUEST_URI']]) ?>">
<?= _('Alle Benachrichtigungen als gelesen markieren') ?>
</a>
<a class="enable-desktop-notifications" href="#" style="display: none;">
<?= _('Desktop-Benachrichtigungen aktivieren') ?>
</a>
<ul>
<? foreach ($notifications as $notification) : ?>
<?= $notification->getLiElement() ?>
<? endforeach ?>
</ul>
</div>
<? if (PersonalNotifications::isAudioActivated()): ?>
<audio id="audio_notification" preload="none">
<source src="<?= Assets::url('sounds/blubb.ogg') ?>" type="audio/ogg">
<source src="<?= Assets::url('sounds/blubb.mp3') ?>" type="audio/mpeg">
</audio>
<? endif; ?>
<? else: ?>
<div id="notification-container"></div>
<? if (Navigation::hasItem('/avatar')): ?>
<div id="avatar-menu">
<?php
$action_menu = ContentGroupMenu::get();
$action_menu->addCSSClass('avatar-menu');
$action_menu->addAttribute('data-action-menu-reposition', 'false');
$action_menu->setLabel(User::findCurrent()->getFullName());
$action_menu->setAriaLabel(_('Profilmenü'));
$action_menu->setIcon(
Avatar::getAvatar(User::findCurrent()->id)->getImageTag(Avatar::MEDIUM),
['id' => 'header_avatar_image_link']
foreach (Navigation::getItem('/avatar') as $subnav) {
$action_menu->addLink(
URLHelper::getURL($subnav->getURL(), [], true),
$subnav->getTitle(),
$subnav->getImage()
);
}
SkipLinks::addIndex(_('Profilmenü'), "header_avatar_image_link", 1);
?>
<?= $action_menu->render(); ?>
</div>
<? endif; ?>
</li>
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!-- End top bar -->
<!-- Main navigation and right-hand logo -->
<nav id="navigation-level-1" aria-current="page" aria-label="<?= _('Hauptnavigation') ?>">
<? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2); ?>
<ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>>
<? foreach ($header_nav['visible'] as $path => $nav): ?>
<?= $this->render_partial(
'header-navigation-item.php',
compact('path', 'nav')
) ?>
<? endforeach; ?>
<li class="overflow">
<input type="checkbox" id="header-sink">
<label for="header-sink">
<a class="canvasready" href="#">
<?= Icon::create('action', 'navigation')->asImg(28, [
'class' => 'headericon original',
'title' => '',
'alt' => '',
]) ?>
<div class="navtitle">
<?= _('Mehr') ?>…
</div>
</a>
</label>
<ul>
<? foreach ($header_nav['hidden'] as $path => $nav) : ?>
<?= $this->render_partial(
'header-navigation-item.php',
compact('path', 'nav')
) ?>
<? endforeach; ?>
</ul>
</li>
</ul>
<!-- Stud.IP Logo -->
<a class="studip-logo" id="top-logo" href="http://www.studip.de/" title="Stud.IP Homepage" target="_blank" rel="noopener noreferrer">
Stud.IP Homepage
</a>
</nav>
<!-- End main navigation -->
<? $contextable = Context::get() && (
(Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive()) ||
(Navigation::hasItem('/admin/institute') && Navigation::getItem('/admin/institute')->isActive())); ?>
<div id="current-page-structure" <? if (!($contextable)) echo 'class="contextless"'; ?>>
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<? if (PageLayout::isHeaderEnabled() && Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive() && $_SESSION['seminar_change_view_'.Context::getId()]) : ?>
<?= $this->render_partial('change_view', ['changed_status' => $_SESSION['seminar_change_view_'.Context::getId()]]) ?>
<? endif ?>
<? if (Context::get() || PageLayout::isHeaderEnabled()): ?>
<? if (is_object($GLOBALS['perm']) && !$GLOBALS['perm']->have_perm('admin') && $contextable) : ?>
<? $membership = CourseMember::find([Context::get()->id, $GLOBALS['user']->id]) ?>
<? if ($membership) : ?>
<a href="<?= URLHelper::getLink('dispatch.php/my_courses/groups') ?>"
data-dialog
class="colorblock gruppe<?= $membership ? $membership['gruppe'] : 1 ?>"></a>
<? endif ?>
<? endif ?>
<? if ($contextable) : ?>
<div id="context-title">
<? if (Context::isCourse()) : ?>
<?= Icon::create('seminar', Icon::ROLE_INFO)->asImg(20, ['class' => 'context_icon']) ?>
<?= htmlReady(Context::get()->getFullname()) ?>
<? elseif (Context::isInstitute()) : ?>
<?= Icon::create('institute', Icon::ROLE_INFO)->asImg(20, ['class' => 'context_icon']) ?>
<?= htmlReady(Context::get()->name) ?>
<? endif ?>
</div>
<? endif ?>
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?>
<nav id="navigation-level-2" aria-current="page" aria-label="<?= _('Zweite Navigationsebene') ?>">
<? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?>
<?= $this->render_partial('tabs', compact('navigation', 'membership')) ?>
<? endif; ?>
</nav>
<? endif; ?>
<?
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 (isset($GLOBALS['SessSemName']['class']) && $GLOBALS['SessSemName']['class'] === 'inst') {
$header_template->public_hint = _('öffentliche Einrichtung');
} else if (Course::findCurrent()->lesezugriff == 0) {
$header_template->public_hint = _('öffentliche Veranstaltung');
}
}
}
?>
<div id="page-title-container" class="hidden-medium-up">
<div id="page-title">
<? if (Context::get() && strpos(PageLayout::getTitle(), Context::getHeaderLine() . ' - ') !== FALSE) : ?>
<?= htmlReady(str_replace(Context::getHeaderLine() . ' - ' , '', PageLayout::getTitle())) ?>
<? else: ?>
<?= htmlReady( PageLayout::getTitle()) ?>
<? endif ?>
<?= !empty($public_hint) ? '(' . htmlReady($public_hint) . ')' : '' ?>
</div>
</div>
<!-- End main site header -->
</header>