1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<?php
# Lifter010: TODO
/*
* CommunityNavigation.php - navigation for community page
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Elmar Ludwig
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*/
/**
* Navigation for the community page used for user interaction.
* It includes the contacts, study groups and ranking.
*/
class CommunityNavigation extends Navigation
{
public function __construct()
{
parent::__construct(_('Community'));
}
public function initItem()
{
parent::initItem();
$onlinetip = _('Nur Sie sind online');
$user_count = get_users_online_count();
if ($user_count) {
if ($user_count == 1) {
$onlinetip = _('Außer Ihnen ist eine Person online');
} else {
$onlinetip = sprintf(_('Es sind außer Ihnen %d Personen online'), $user_count);
}
}
$this->setImage(Icon::create('community', 'navigation', ["title" => $onlinetip]));
}
/**
* Initialize the subnavigation of this item. This method
* is called once before the first item is added or removed.
*/
public function initSubNavigation()
{
global $perm;
parent::initSubNavigation();
if (Config::get()->BLUBBER_GLOBAL_MESSENGER_ACTIVATE) {
//Blubber messenger
$navigation = new Navigation(_('Blubber'), 'dispatch.php/blubber');
$this->addSubNavigation('blubber', $navigation);
}
// online list
$navigation = new Navigation(_('Wer ist online?'), 'dispatch.php/online/index');
$this->addSubNavigation('online', $navigation);
// contacts
$navigation = new Navigation(_('Kontakte'), 'dispatch.php/contact');
$this->addSubNavigation('contacts', $navigation);
// study groups
if (Config::get()->STUDYGROUPS_ENABLE) {
$navigation = new Navigation(_('Studiengruppen'));
$navigation->addSubNavigation('browse', new Navigation(_('Studiengruppensuche'), 'dispatch.php/studygroup/browse'));
if (Config::get()->MY_COURSES_ENABLE_STUDYGROUPS && !$GLOBALS['perm']->have_perm('admin')) {
$navigation->addSubNavigation('index', new Navigation(_('Meine Studiengruppen'), 'dispatch.php/my_studygroups'));
}
$this->addSubNavigation('studygroups', $navigation);
}
// ranking
if (Config::get()->SCORE_ENABLE) {
$navigation = new Navigation(_('Rangliste'), 'dispatch.php/score');
$this->addSubNavigation('score', $navigation);
}
}
}
|