id != 'nobody') ? 'dispatch.php/start' : 'index.php?again=yes'; parent::__construct(_('Start'), $url); } public function initItem() { parent::initItem(); $news = 0; $vote = 0; $plugin_manager = PluginManager::getInstance(); $news_widget = $plugin_manager->getPluginInfo('NewsWidget'); $eval_widget = $plugin_manager->getPluginInfo('EvaluationsWidget'); if (mb_stripos($_SERVER['REQUEST_URI'], "web_migrate.php") === false && is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') { if (WidgetUser::hasWidget($GLOBALS['user']->id, $news_widget['id'])) { $news = StudipNews::CountUnread(); } if (Config::get()->VOTE_ENABLE && WidgetUser::hasWidget($GLOBALS['user']->id, $eval_widget['id'])) { $threshold = object_get_visit_threshold(); $statement = DBManager::get()->prepare(" SELECT COUNT(*) FROM questionnaire_assignments INNER JOIN questionnaires ON (questionnaires.questionnaire_id = questionnaire_assignments.questionnaire_id) LEFT JOIN object_user_visits b ON (b.object_id = questionnaires.questionnaire_id AND b.user_id = :user_id AND b.plugin_id = :plugin_id) WHERE questionnaire_assignments.range_id = 'start' AND questionnaires.chdate > IFNULL(b.visitdate, :threshold) AND questionnaires.user_id <> :user_id AND questionnaires.startdate IS NOT NULL AND questionnaires.startdate < UNIX_TIMESTAMP() AND ( questionnaires.stopdate IS NULL OR questionnaires.stopdate > UNIX_TIMESTAMP() ) "); $statement->execute(['threshold' => $threshold, ':user_id' => $GLOBALS['user']->id, ':plugin_id' => -1]); $vote = (int) $statement->fetchColumn(); } } $homeinfo = _('Zur Startseite'); if ($news) { $homeinfo .= ' - '; $homeinfo .= sprintf(ngettext('%u neue Ankündigung', '%u neue Ankündigungen', $news), $news); } if ($vote) { $homeinfo .= ' - '; $homeinfo .= sprintf(ngettext('%u neuer Fragebogen', '%u neue Fragebögen', $vote), $vote); } $this->setBadgeNumber($vote + $news); $this->setImage(Icon::create('home', 'navigation', ["title" => $homeinfo])); } /** * Determine whether this navigation item is active. */ public function isActive() { return $this->active; } /** * Initialize the subnavigation of this item. This method * is called once before the first item is added or removed. */ public function initSubNavigation() { global $perm, $auth; parent::initSubNavigation(); if (!is_object($perm) || !$perm->have_perm('user')) { return; } $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, ['root','admin','dozent']) ? Config::get()->SEM_CREATE_PERM : 'dozent'; $new_course_item = new Navigation(_('Neue Veranstaltung anlegen'), 'dispatch.php/course/wizard'); $new_course_item->setLinkAttributes(['data-dialog' => '']); $new_studygroup_item = new Navigation(_('Studiengruppe anlegen'), 'dispatch.php/course/wizard?studygroup=1'); $new_studygroup_item->setLinkAttributes(['data-dialog' => '']); // my courses if ($perm->have_perm('root')) { $navigation = new Navigation(_('Veranstaltungsübersicht'), 'dispatch.php/admin/courses'); } else if ($perm->have_perm('admin')) { $navigation = new Navigation(_('Veranstaltungen an meinen Einrichtungen'), 'dispatch.php/my_courses'); } else { $navigation = new Navigation(_('Meine Veranstaltungen'), 'dispatch.php/my_courses'); if (!$perm->have_perm('dozent')) { $navigation->addSubNavigation('browse', new Navigation(_('Veranstaltung hinzufügen'), 'dispatch.php/search/courses')); if ($perm->have_perm('autor') && Config::get()->STUDYGROUPS_ENABLE) { $navigation->addSubNavigation('new_studygroup', $new_studygroup_item); } } else { if ($perm->have_perm($sem_create_perm)) { $navigation->addSubNavigation('new_course', $new_course_item); } if (Config::get()->STUDYGROUPS_ENABLE) { $navigation->addSubNavigation('new_studygroup', $new_studygroup_item); } } } // coursesets if ($perm->have_perm('admin') || (Config::get()->ALLOW_DOZENT_COURSESET_ADMIN && $perm->have_perm('dozent'))) { $navigation->addSubNavigation('coursesets', new Navigation(_('Anmeldesets'), 'dispatch.php/admission/courseset')); } $this->addSubNavigation('my_courses', $navigation); // course administration if ($perm->have_perm('admin')) { $navigation = new Navigation(_('Verwaltung von Veranstaltungen'), 'dispatch.php/my_courses'); if ($perm->have_perm($sem_create_perm)) { $navigation->addSubNavigation('new_course', $new_course_item); } if (Config::get()->STUDYGROUPS_ENABLE) { $navigation->addSubNavigation('new_studygroup', $new_studygroup_item); } $this->addSubNavigation('admin_course', $navigation); } // insitute administration if ($perm->have_perm('admin')) { $navigation = new Navigation(_('Verwaltung von Einrichtungen'), 'dispatch.php/institute/basicdata/index?list=TRUE'); $this->addSubNavigation('admin_inst', $navigation); } // user administration if ($perm->have_perm('root') || $perm->have_perm('admin') && !Config::get()->RESTRICTED_USER_MANAGEMENT) { $navigation = new Navigation(_('Globale Benutzerverwaltung'), 'dispatch.php/admin/user'); $this->addSubNavigation('admin_user', $navigation); } // plugin and role administration if ($perm->have_perm('root')) { $navigation = new Navigation(_('Verwaltung von Plugins'), 'dispatch.php/admin/plugin'); $navigation->addSubNavigation('admin_roles', new Navigation(_('Verwaltung von Rollen'), 'dispatch.php/admin/role')); $this->addSubNavigation('admin_plugins', $navigation); } // administration of resources if (Config::get()->RESOURCES_ENABLE) { $current_user = User::findCurrent(); $global_resource_permissions = ResourceManager::getGlobalResourcePermission( $current_user ); $show_resources_navigation = false; if ($global_resource_permissions == 'admin') { $show_resources_navigation = true; } else { $show_resources_navigation = RoomManager::userHasRooms( $current_user, 'user' ); } if ($show_resources_navigation) { if ($global_resource_permissions == 'admin') { $navigation = new Navigation(_('Raumverwaltung')); $navigation->addSubNavigation( 'resources_overview', new Navigation( _('Übersicht'), 'dispatch.php/room_management/overview/index' ) ); $navigation->addSubNavigation( 'room_planning', new Navigation( _('Raumplanung'), 'dispatch.php/room_management/planning/index' ) ); $navigation->addSubNavigation( 'categories', new Navigation( _('Ressourcenkategorien anpassen'), 'dispatch.php/resources/admin/categories' ) ); $this->addSubNavigation('resources', $navigation); } else { //Users who are not resource admins see another page that //displays only those resources where they have permissions for. $navigation = new Navigation( _('Meine Räume'), 'dispatch.php/room_management/overview/rooms' ); $this->addSubNavigation('resources', $navigation); } } } // contents $navigation = new Navigation(_('Mein Arbeitsplatz'), 'dispatch.php/contents/overview'); if (PluginManager::getInstance()->getPlugin(CoursewareModule::class)) { $navigation->addSubNavigation('courseware', new Navigation(_('Courseware'), 'dispatch.php/contents/courseware')); } $navigation->addSubNavigation('files', new Navigation(_('Dateien'), 'dispatch.php/files/overview')); if (Config::get()->VOTE_ENABLE) { $navigation->addSubNavigation('questionnaire', new Navigation(_('Ankündigungen'), 'dispatch.php/news/admin_news')); } if (!$GLOBALS['perm']->have_perm('root') && $GLOBALS['user']->getAuthenticatedUser()->hasRole('Hilfe-Administrator(in)')) { $navigation->addSubNavigation('help_content', new Navigation(_('Hilfe-Texte und Touren'), 'dispatch.php/help_content/admin_overview')); } $this->addSubNavigation('contents', $navigation); // oer if (Config::get()->OERCAMPUS_ENABLED && $perm->have_perm(Config::get()->OER_PUBLIC_STATUS)) { $this->addSubNavigation('oer', new Navigation(_('OER Campus'), 'dispatch.php/oer/market')); } // messaging $navigation = new Navigation(_('Nachrichten')); $navigation->addSubNavigation('in', new Navigation(_('Posteingang'), 'dispatch.php/messages/overview')); $navigation->addSubNavigation('out', new Navigation(_('Gesendet'), 'dispatch.php/messages/sent')); $this->addSubNavigation('messaging', $navigation); // community $navigation = new Navigation(_('Community')); $navigation->addSubNavigation('online', new Navigation(_('Wer ist online?'), 'dispatch.php/online')); $navigation->addSubNavigation('contacts', new Navigation(_('Meine Kontakte'), 'dispatch.php/contact')); // study groups if (Config::get()->STUDYGROUPS_ENABLE) { $navigation->addSubNavigation('browse',new Navigation(_('Studiengruppen'), 'dispatch.php/studygroup/browse')); } // ranking if (Config::get()->SCORE_ENABLE) { $navigation->addSubNavigation('score', new Navigation(_('Rangliste'), 'dispatch.php/score')); $this->addSubNavigation('community', $navigation); } // calendar / home page if (!$perm->have_perm('admin')) { $navigation = new Navigation(_('Mein Profil'), 'dispatch.php/profile'); if ($perm->have_perm('autor')) { $navigation->addSubNavigation('settings', new Navigation(_('Einstellungen'), 'dispatch.php/settings/general')); } $this->addSubNavigation('profile', $navigation); $navigation = new Navigation(_('Planer')); if (Config::get()->CALENDAR_ENABLE) { $navigation->addSubNavigation('calendar', new Navigation(_('Kalender'), 'dispatch.php/calendar/calendar')); } if (Config::get()->SCHEDULE_ENABLE) { $navigation->addSubNavigation('schedule', new Navigation(_('Stundenplan'), 'dispatch.php/calendar/schedule')); } $this->addSubNavigation('planner', $navigation); } // global search $navigation = new Navigation(_('Suchen'), 'dispatch.php/search/globalsearch'); $navigation->addSubNavigation('course', new Navigation(_('Veranstaltungssuche'), 'dispatch.php/search/courses')); if (Config::get()->RESOURCES_ENABLE) { $navigation->addSubNavigation('rooms', new Navigation(_('Räume suchen'), 'dispatch.php/resources/search/rooms')); } $this->addSubNavigation('search', $navigation); //mvv pages if (MVV::isVisible()) { $this->addSubNavigation('mvv', new MVVNavigation()); } // external help $navigation = new Navigation(_('Hilfe'), format_help_url('Basis.Allgemeines')); $navigation->addSubNavigation('intro', new Navigation(_('Schnelleinstieg'), format_help_url('Basis.SchnellEinstiegKomplett'))); $this->addSubNavigation('help', $navigation); } }