aboutsummaryrefslogtreecommitdiff
path: root/lib/modules
diff options
context:
space:
mode:
Diffstat (limited to 'lib/modules')
-rw-r--r--lib/modules/ActivityFeed.php77
-rw-r--r--lib/modules/Blubber.class.php126
-rw-r--r--lib/modules/ContentsWidget.php30
-rw-r--r--lib/modules/CoreForum.class.php209
-rw-r--r--lib/modules/EvaluationsWidget.php62
-rw-r--r--lib/modules/NewsWidget.php65
-rw-r--r--lib/modules/QuickSelection.php57
-rw-r--r--lib/modules/ScheduleWidget.php54
-rw-r--r--lib/modules/TerminWidget.php43
9 files changed, 723 insertions, 0 deletions
diff --git a/lib/modules/ActivityFeed.php b/lib/modules/ActivityFeed.php
new file mode 100644
index 0000000..6fa9ce3
--- /dev/null
+++ b/lib/modules/ActivityFeed.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * @author André Klaßen <klassen@elan-ev.de>
+ * @author Till Glöggler <tgloeggl@uos.de>
+ * @license GPL 2 or later
+ */
+class ActivityFeed extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Aktivitäten');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie alle Aktivitäten im Überblick.')
+ ];
+ }
+
+ public function getPortalTemplate()
+ {
+ $template = $GLOBALS['template_factory']->open('start/activityfeed');
+
+ $template->user_id = $GLOBALS['user']->id;
+ $template->scrolledfrom = strtotime('+1 day');
+ $template->config = WidgetHelper::getWidgetUserConfig($GLOBALS['user']->id, 'ACTIVITY_FEED');
+
+ $navigation = new Navigation('', 'dispatch.php/activityfeed/configuration');
+ $navigation->setImage(Icon::create('edit', 'clickable', ["title" => _('Konfigurieren')]), ['data-dialog'=>'size=auto']);
+ $icons[] = $navigation;
+
+ $navigation = new Navigation('', '#', ['cid' => null]);
+ $navigation->setImage(Icon::create('headache+visibility-visible', 'clickable'));
+ $navigation->setLinkAttributes([
+ 'id' => 'toggle-user-activities',
+ 'title' => _('Eigene Aktivitäten ein-/ausblenden'),
+ ]);
+ $icons[] = $navigation;
+
+ $navigation = new Navigation('', '#', ['cid' => null]);
+ $navigation->setImage(Icon::create('no-activity', 'clickable'));
+ $navigation->setLinkAttributes([
+ 'id' => 'toggle-all-activities',
+ 'title' => _('Aktivitätsdetails ein-/ausblenden'),
+ ]);
+ $icons[] = $navigation;
+
+ $template->icons = $icons;
+
+ return $template;
+ }
+
+ public static function onEnable($pluginId)
+ {
+ $errors = [];
+ if (!Config::get()->API_ENABLED) {
+ $errors[] = sprintf(
+ _('Die REST-API ist nicht aktiviert (%s "API_ENABLED")'),
+ formatReady(sprintf('[%s]%s',
+ _('Konfiguration'),
+ URLHelper::getLink('dispatch.php/admin/configuration/configuration')
+ ))
+ );
+ } elseif (!RESTAPI\ConsumerPermissions::get('global')->check('/user/:user_id/activitystream', 'get')) {
+ $errors[] = sprintf(
+ _('Die REST-API-Route ist nicht aktiviert (%s "/user/:user_id/activitystream"")'),
+ formatReady(sprintf('[%s]%s',
+ _('Konfiguration'),
+ URLHelper::getLink('dispatch.php/admin/api/permissions')
+ ))
+ );
+ }
+
+ return count($errors) === 0;
+ }
+}
diff --git a/lib/modules/Blubber.class.php b/lib/modules/Blubber.class.php
new file mode 100644
index 0000000..d9b5579
--- /dev/null
+++ b/lib/modules/Blubber.class.php
@@ -0,0 +1,126 @@
+<?php
+/*
+ * Copyright (c) 2012-2019 Rasmus Fuhse <fuhse@data-quest.de>
+ *
+ * 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.
+ */
+
+/**
+ * Class Blubber - the Blubber-plugin
+ * This is only used to manage blubber within a course.
+ */
+class Blubber extends CorePlugin implements StudipModule
+{
+ /**
+ * Returns a navigation for the tab displayed in the course.
+ * @param string $course_id of the course
+ * @return \Navigation
+ */
+ public function getTabNavigation($course_id)
+ {
+ $tab = new Navigation(
+ _('Blubber'),
+ 'dispatch.php/course/messenger/course'
+ );
+ $tab->setImage(Icon::create('blubber', Icon::ROLE_INFO_ALT));
+ return ['blubber' => $tab];
+ }
+
+ /**
+ * Returns a navigation-object with the grey/red icon for displaying in the
+ * my_courses.php page.
+ * @param string $course_id
+ * @param int $last_visit
+ * @param string|null $user_id
+ * @return \Navigation
+ */
+ public function getIconNavigation($course_id, $last_visit, $user_id = null)
+ {
+ $user_id || $user_id = $GLOBALS['user']->id;
+ $icon = new Navigation(
+ _('Blubber'),
+ 'dispatch.php/course/messenger/course'
+ );
+ $icon->setImage(Icon::create('blubber', Icon::ROLE_CLICKABLE, ['title' => _('Blubber-Messenger')]));
+
+ $condition = "INNER JOIN blubber_threads USING (thread_id)
+ WHERE blubber_threads.context_type = 'course'
+ AND blubber_threads.context_id = :course_id
+ AND blubber_comments.mkdate >= :last_visit
+ AND blubber_comments.user_id != :me
+ AND blubber_threads.visible_in_stream = 1
+ ";
+ $comments = BlubberComment::findBySQL($condition, [
+ 'course_id' => $course_id,
+ 'last_visit' => $last_visit,
+ 'me' => $user_id,
+ ]);
+ foreach ($comments as $comment) {
+ if ($comment->thread->isVisibleInStream() && $comment->thread->isReadable() && ($comment->thread->getLatestActivity() > UserConfig::get($user_id)->getValue("BLUBBERTHREAD_VISITED_".$comment['thread_id']))) {
+ $icon->setImage(Icon::create('blubber', Icon::ROLE_NEW, ['title' => _('Es gibt neue Blubber')]));
+ $icon->setTitle(_('Es gibt neue Blubber'));
+ $icon->setBadgeNumber(count($comments));
+ $icon->setURL('dispatch.php/course/messenger/course', ['thread' => 'new']);
+ break;
+ }
+ }
+
+ $condition = "context_type = 'course'
+ AND context_id = :course_id
+ AND mkdate >= :last_visit
+ AND user_id != :me
+ AND visible_in_stream = 1
+ AND (
+ blubber_threads.display_class IS NOT NULL
+ OR blubber_threads.`content` IS NOT NULL
+ )";
+ $threads = BlubberThread::findBySQL($condition, [
+ 'course_id' => $course_id,
+ 'last_visit' => $last_visit,
+ 'me' => $GLOBALS['user']->id,
+ ]);
+ foreach ($threads as $thread) {
+ if ($thread->isVisibleInStream() && $thread->isReadable() && ($thread['mkdate'] > UserConfig::get($user_id)->getValue("BLUBBERTHREAD_VISITED_".$thread->getId()))) {
+ $icon->setImage(Icon::create('blubber', Icon::ROLE_ATTENTION, ['title' => _('Es gibt neue Blubber')]));
+ $icon->setTitle(_('Es gibt neue Blubber'));
+ break;
+ }
+ }
+ return $icon;
+ }
+
+ /**
+ * Returns no template, because this plugin doesn't want to insert an
+ * info-template in the course-overview.
+ * @param string $course_id
+ * @return null
+ */
+ public function getInfoTemplate($course_id)
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetadata()
+ {
+ return [
+ 'summary' => _('Schneller und einfacher Austausch von Informationen in Gesprächsform'),
+ 'description' => _('Blubber ist eine Kommunikationsform mit Ähnlichkeiten zu einem Forum, in dem aber in Echtzeit miteinander kommuniziert werden kann und das durch den etwas informelleren Charakter eher einem Chat anmutet. Anders als im Forum ist es nicht notwendig, die Seiten neu zu laden, um die neuesten Einträge (z. B. Antworten auf eigene Postings) sehen zu können: Die Seite aktualisiert sich selbst bei neuen Einträgen. Dateien (z.B. Fotos, Audiodateien, Links) können per Drag and Drop in das Feld gezogen und somit verlinkt werden. Auch Textformatierungen und das Verwenden von Smileys sind möglich.'),
+ 'descriptionlong' => _('Kommunikationsform mit Ähnlichkeiten zu einem Forum. Im Gegensatz zum Forum kann mit Blubber jedoch in Echtzeit miteinander kommuniziert werden. Das Tool ähnelt durch den etwas informelleren Charakter einem Messenger. Anders als im Forum ist es nicht notwendig, die Seiten neu zu laden, um die neuesten Einträge (z. B. Antworten auf eigene Postings) sehen zu können. Dateien (z. B. Fotos, Audiodateien, Links) können per drag and drop in das Feld gezogen und somit verlinkt werden. Auch Textformatierungen und das Verwenden von Smileys sind möglich.'),
+ 'category' => _('Kommunikation und Zusammenarbeit'),
+ 'keywords' => _('Einfach Text schreiben und mit <Enter> abschicken; Direktes Kontaktieren anderer Stud.IP-NutzerInnen (@Vorname Nachname); Setzen von und Suche nach Stichworten über Hashtags (#Stichwort); Einbinden von Dateien per drag and drop'),
+ 'icon' => Icon::create('blubber', Icon::ROLE_INFO),
+ 'screenshots' => [
+ 'path' => 'assets/images/plus/screenshots/Blubber',
+ 'pictures' => [
+ ['source' => 'blubberscreenshot.png', 'title' => 'Blubbern']
+ ]
+ ]
+ ];
+ }
+}
diff --git a/lib/modules/ContentsWidget.php b/lib/modules/ContentsWidget.php
new file mode 100644
index 0000000..1907ba6
--- /dev/null
+++ b/lib/modules/ContentsWidget.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Contents widget.
+ *
+ * @author David Siegfried <ds.siegfried@gmail.com>
+ * @license GPL2 or any later version
+ * @since Stud.IP 5.0
+ */
+
+class ContentsWidget extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Mein Arbeitsplatz');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie einen Überblick über Ihre Inhalte.')
+ ];
+ }
+
+ public function getPortalTemplate()
+ {
+ $template = $GLOBALS['template_factory']->open('start/contents');
+ $template->tiles = Navigation::getItem('/contents');
+ return $template;
+ }
+}
diff --git a/lib/modules/CoreForum.class.php b/lib/modules/CoreForum.class.php
new file mode 100644
index 0000000..88dd5dd
--- /dev/null
+++ b/lib/modules/CoreForum.class.php
@@ -0,0 +1,209 @@
+<?php
+/*
+ * Forum.class.php - Forum
+ *
+ * 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 Till Glöggler <till.gloeggler@elan-ev.de>
+ * @copyright 2011 ELAN e.V. <http://www.elan-ev.de>
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
+ * @category Stud.IP
+ */
+
+// Notifications
+NotificationCenter::addObserver('CoreForum', 'overviewDidClear', 'OverviewDidClear');
+NotificationCenter::addObserver('CoreForum', 'removeAbosForUserAndCourse', 'UserDidLeaveCourse');
+
+NotificationCenter::addObserver('ForumActivity', 'newEntry', 'ForumAfterInsert');
+NotificationCenter::addObserver('ForumActivity', 'updateEntry', 'ForumAfterUpdate');
+NotificationCenter::addObserver('ForumActivity', 'deleteEntry', 'ForumBeforeDelete');
+
+NotificationCenter::addObserver('ForumIssue', 'unlinkIssue', 'ForumBeforeDelete');
+
+class CoreForum extends CorePlugin implements ForumModule
+{
+ /* interface method */
+ public function getTabNavigation($course_id)
+ {
+ $navigation = new Navigation(_('Forum'), 'dispatch.php/course/forum/index');
+ $navigation->setImage(Icon::create('forum', 'info_alt'));
+
+ // add main third-level navigation-item
+ $navigation->addSubNavigation('index', new Navigation(_('Übersicht'), 'dispatch.php/course/forum/index'));
+
+ if (ForumPerm::has('fav_entry', $course_id)) {
+ $navigation->addSubNavigation('newest', new Navigation(_("Neue Beiträge"), 'dispatch.php/course/forum/index/newest'));
+ $navigation->addSubNavigation('latest', new Navigation(_("Letzte Beiträge"), 'dispatch.php/course/forum/index/latest'));
+ $navigation->addSubNavigation('favorites', new Navigation(_('Gemerkte Beiträge'), 'dispatch.php/course/forum/index/favorites'));
+
+ // mass-administrate the forum
+ if (ForumPerm::has('admin', $course_id)) {
+ $navigation->addSubNavigation('admin', new Navigation(_('Administration'), 'dispatch.php/course/forum/admin'));
+ }
+ }
+
+ return ['forum2' => $navigation];
+ }
+
+ /* interface method */
+ public function getIconNavigation($course_id, $last_visit, $user_id = null)
+ {
+ if ($GLOBALS['perm']->have_studip_perm('user', $course_id)) {
+ $num_entries = ForumVisit::getCount($course_id, ForumVisit::getVisit($course_id));
+ $text = ForumHelpers::getVisitText($num_entries, $course_id);
+ } else {
+ $num_entries = 0;
+ $text = 'Forum';
+ }
+
+ $navigation = new Navigation('forum', 'dispatch.php/course/forum/index/enter_seminar');
+ $navigation->setBadgeNumber($num_entries);
+
+ if ($num_entries > 0) {
+ $navigation->setImage(Icon::create('forum', Icon::ROLE_ATTENTION, ['title' => $text]));
+ } else {
+ $navigation->setImage(Icon::create('forum', Icon::ROLE_CLICKABLE, ['title' => $text]));
+ }
+
+ return $navigation;
+ }
+
+ /**
+ * This method is called, whenever an user clicked to clear the visit timestamps
+ * and set everything as visited
+ *
+ * @param object $notification
+ * @param string $user_id
+ */
+ public static function overviewDidClear($notification, $user_id)
+ {
+ $query = "REPLACE INTO `forum_visits`
+ SELECT `user_id`, `Seminar_id`, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
+ FROM `seminar_user`
+ WHERE `user_id` = ?";
+ DBManager::get()->execute($query, [$user_id]);
+ }
+
+ /**
+ * This method is called whenever a user is removed from a course and thus
+ * the forum abos will be removed.
+ *
+ * @param object $notification
+ * @param string $course_id
+ * @param string $user_id
+ */
+ public static function removeAbosForUserAndCourse($notification, $course_id, $user_id)
+ {
+ ForumAbo::removeForCourseAndUser($course_id, $user_id);
+ }
+
+ public function getInfoTemplate($course_id)
+ {
+ return null;
+ }
+
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ /* * IMPLEMENTATION OF METHODS FROM FORUMMODULE-INTERFACE * */
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ public function getLinkToThread($issue_id)
+ {
+ if ($topic_id = ForumIssue::getThreadIdForIssue($issue_id)) {
+ return URLHelper::getLink('dispatch.php/course/forum/index/index/' . $topic_id);
+ }
+
+ return false;
+ }
+
+ public function setThreadForIssue($issue_id, $title, $content)
+ {
+ ForumIssue::setThreadForIssue(Context::getId(), $issue_id, $title, $content);
+ }
+
+ public function getNumberOfPostingsForUser($user_id, $seminar_id = null)
+ {
+ return ForumEntry::countUserEntries($user_id, $seminar_id);
+ }
+
+ public function getNumberOfPostingsForIssue($issue_id)
+ {
+ $topic_id = ForumIssue::getThreadIdForIssue($issue_id);
+
+ return $topic_id ? ForumEntry::countEntries($topic_id) : 0;
+ }
+
+ public function getNumberOfPostingsForSeminar($seminar_id)
+ {
+ return floor(ForumEntry::countEntries($seminar_id));
+ }
+
+ public function getNumberOfPostings()
+ {
+ return ForumEntry::countAllEntries();
+ }
+
+ public function getEntryTableInfo()
+ {
+ return [
+ 'table' => 'forum_entries',
+ 'content' => 'content',
+ 'chdate' => 'chdate',
+ 'seminar_id' => 'seminar_id',
+ 'user_id' => 'user_id'
+ ];
+ }
+
+ public function getTopTenSeminars()
+ {
+ return ForumEntry::getTopTenSeminars();
+ }
+
+ public function migrateUser($user_from, $user_to)
+ {
+ return ForumEntry::migrateUser($user_from, $user_to);
+ }
+
+ public function deleteContents($seminar_id)
+ {
+ return ForumEntry::delete($seminar_id);
+ }
+
+ public function getDump($seminar_id)
+ {
+ return ForumEntry::getDump($seminar_id);
+ }
+
+ public static function getDescription()
+ {
+ return _('Textbasierte und zeit- und ortsunabhängige '.
+ 'Diskursmöglichkeit. Lehrende können parallel zu '.
+ 'Veranstaltungsthemen Fragen stellen, die von den Studierenden '.
+ 'per Meinungsaustausch besprochen werden.');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetadata()
+ {
+ return [
+ 'summary' => _('Veranstaltungsbegleitender Meinungsaustausch zu bestimmten Themen'),
+ 'description' => _('Textbasierte zeit- und ortsunabhängige Möglichkeit zum Austausch von Gedanken, Meinungen und Erfahrungen. Lehrende und/oder Studierende können parallel zu Veranstaltungsthemen Fragen stellen, die in Form von Textbeiträgen besprochen werden können. Diese Beiträge können von allen Teilnehmenden der Veranstaltung gemerkt, verlinkt, positiv bewertet (sog. "Gefällt mir") und editiert werden (Letzeres nur von Lehrenden). Lehrende können zusätzlich Themen in Bereiche gliedern, zwischen den Bereichen verschiebe, im Bereich hervorheben und diesen öffnen und schließen.'),
+ 'descriptionlong' => _('Textbasierte zeit- und ortsunabhängige Möglichkeit zum Austausch von Gedanken, Meinungen und Erfahrungen. Lehrende und/oder Studierende können parallel zu Veranstaltungsthemen Fragen stellen, die in Form von Textbeiträgen besprochen werden können. Diese Beiträge können von allen Teilnehmenden der Veranstaltung gemerkt, verlinkt, positiv bewertet (sog. "Gefällt mir") und editiert werden (Letzeres nur von Lehrenden). Lehrende können zusätzlich Themen in Bereiche gliedern, zwischen den Bereichen verschieben, im Bereich hervorheben und diesen öffnen und schließen.'),
+ 'category' => _('Kommunikation und Zusammenarbeit'),
+ 'keywords' => _('Möglichkeit zum intensiven, nachhaltigen textbasierten Austausch; (nachträgliche) Strukturierung der Beiträge; Editierfunktion für Lehrende'),
+ 'icon' => Icon::create('forum', Icon::ROLE_INFO),
+ 'screenshots' => [
+ 'path' => 'assets/images/plus/screenshots/Forum',
+ 'pictures' => [
+ ['source' => 'Lehrendensicht_-_Kategorien_mit_Bereichen_und_Beitraegen.jpg'],
+ ['source' => 'Studentische_Sicht_-_Kategorien_mit_Bereichen_und_Beitraegen.jpg'],
+ ['source' => 'Einen_Forumsbeitrag_erstellen.jpg'],
+ ]
+ ]
+ ];
+ }
+}
diff --git a/lib/modules/EvaluationsWidget.php b/lib/modules/EvaluationsWidget.php
new file mode 100644
index 0000000..4c902c7
--- /dev/null
+++ b/lib/modules/EvaluationsWidget.php
@@ -0,0 +1,62 @@
+<?php
+/*
+ * EvaluationsWidget.php - widget plugin for start page
+ *
+ * Copyright (C) 2014 - Nadine Werner <nadwerner@uos.de>
+ * 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.
+ */
+
+class EvaluationsWidget extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Fragebögen');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie Zugriff auf systemweite Umfragen.')
+ ];
+ }
+
+ /**
+ * Returns the portal widget template.
+ *
+ * Due to a seriously messed up architecture, the suppress_empty_output
+ * variable is used to determine when an according message should be
+ * presented to the user. If no evaluations and questionnaires are present,
+ * the message from the questionnaires should be displayed. The according
+ * message from evaluations should never be shown in the widget. Thus, the
+ * evaluation controller will always suppress this message and the variable
+ * is adjusted if the evaluation returned no content so that the
+ * questionnaire controller will display it's message. If you think, we're
+ * slowly running out of duct tape, you might be absolutely right...
+ */
+ public function getPortalTemplate()
+ {
+ // include and show votes and tests
+ if (Config::get()->VOTE_ENABLE) {
+ $controller = new AuthenticatedController(new StudipDispatcher());
+ $controller->suppress_empty_output = true;
+
+ $response = $controller->relay('evaluation/display/studip')->body;
+
+ $controller->suppress_empty_output = (bool)$response;
+ $response .= $controller->relay('questionnaire/widget/start')->body;
+
+ $template = $GLOBALS['template_factory']->open('shared/string');
+ $template->content = $response;
+
+ if ($GLOBALS['perm']->have_perm('root')) {
+ $navigation = new Navigation('', 'dispatch.php/questionnaire/overview');
+ $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Umfragen bearbeiten')]));
+ $template->icons = [$navigation];
+ }
+ return $template;
+ }
+ }
+}
diff --git a/lib/modules/NewsWidget.php b/lib/modules/NewsWidget.php
new file mode 100644
index 0000000..60af752
--- /dev/null
+++ b/lib/modules/NewsWidget.php
@@ -0,0 +1,65 @@
+<?php
+/*
+ * news.php - News controller
+ *
+ * Copyright (C) 2014 - Nadine Werner <nadwerner@uos.de>
+ * 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.
+ */
+
+require_once 'app/controllers/news.php';
+
+class NewsWidget extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Ankündigungen');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie Zugriff auf systemweite Ankündigungen.')
+ ];
+ }
+
+ function getPortalTemplate()
+ {
+ $dispatcher = new StudipDispatcher();
+ $controller = new NewsController($dispatcher);
+ $response = $controller->relay('news/display/studip');
+ $template = $GLOBALS['template_factory']->open('shared/string');
+ $template->content = $response->body;
+
+ if (StudipNews::CountUnread() > 0) {
+ $navigation = new Navigation('', 'dispatch.php/news/visit_all');
+ $navigation->setImage(Icon::create('refresh', 'clickable', ["title" => _('Alle als gelesen markieren')]));
+ $icons[] = $navigation;
+ }
+
+ if (Config::get()->NEWS_RSS_EXPORT_ENABLE) {
+ if ($rss_id = StudipNews::GetRssIdFromRangeId('studip')) {
+ $navigation = new Navigation('', 'rss.php', ['id' => $rss_id]);
+ $navigation->setImage(Icon::create('rss', 'clickable', ["title" => _('RSS-Feed')]));
+ $icons[] = $navigation;
+ }
+ }
+
+ if ($GLOBALS['perm']->have_perm('root')) {
+ $navigation = new Navigation('', 'dispatch.php/news/edit_news/new/studip');
+ $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Ankündigungen bearbeiten')]), ['rel' => 'get_dialog']);
+ $icons[] = $navigation;
+ if (Config::get()->NEWS_RSS_EXPORT_ENABLE) {
+ $navigation = new Navigation('', 'dispatch.php/news/rss_config/studip');
+ $navigation->setImage(Icon::create('rss+add', 'clickable', ["title" => _('RSS-Feed konfigurieren')]), ["rel" => 'size=auto']);
+ $icons[] = $navigation;
+ }
+ }
+
+ $template->icons = $icons;
+
+ return $template;
+ }
+}
diff --git a/lib/modules/QuickSelection.php b/lib/modules/QuickSelection.php
new file mode 100644
index 0000000..f1a7a2c
--- /dev/null
+++ b/lib/modules/QuickSelection.php
@@ -0,0 +1,57 @@
+<?php
+/*
+ * QuickSelection.php - widget plugin for start page
+ *
+ * Copyright (C) 2014 - Nadine Werner <nadwerner@uos.de>
+ * 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.
+ */
+
+class QuickSelection extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Schnellzugriff');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit dem Schnellzugriff-Widget können Sie Links zu bestimmten Bereichen in Stud.IP verwalten.')
+ ];
+ }
+
+ public function getPortalTemplate()
+ {
+ $names = WidgetHelper::getWidgetUserConfig($GLOBALS['user']->id, 'QUICK_SELECTION');
+
+ $template = $GLOBALS['template_factory']->open('start/quickselection');
+ $template->navigation = $this->getFilteredNavigation($names);
+
+ $navigation = new Navigation('', 'dispatch.php/quickselection/configuration');
+ $navigation->setImage(Icon::create('edit', 'clickable', ["title" => _('Konfigurieren')]), ['data-dialog'=>'size=auto']);
+
+ $template->icons = [$navigation];
+
+ return $template;
+ }
+
+ private function getFilteredNavigation($items)
+ {
+ $result = [];
+
+ $navigation = Navigation::getItem('/start');
+ foreach ($navigation as $name => $nav) {
+ // if config is new (key:value) display values which are not in config array
+ // otherwise hide items which are not in config array
+ // This is important for patching.
+ if (!isset($items[$name]) || $items[$name] !== 'deactivated') {
+ $result[] = $nav;
+ }
+ }
+
+ return $result;
+ }
+}
diff --git a/lib/modules/ScheduleWidget.php b/lib/modules/ScheduleWidget.php
new file mode 100644
index 0000000..339beb3
--- /dev/null
+++ b/lib/modules/ScheduleWidget.php
@@ -0,0 +1,54 @@
+<?php
+/*
+ * This class displays a seminar-schedule for
+ * users on a seminar-based view and for admins on an institute based view
+ *
+ * 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 Till Glöggler <tgloeggl@uos.de>
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
+ * @category Stud.IP
+ */
+
+class ScheduleWidget extends CorePlugin implements PortalPlugin
+{
+ /**
+ * Returns the name of the plugin/widget.
+ *
+ * @return String containing the name
+ */
+ public function getPluginName()
+ {
+ return _('Mein Stundenplan');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie eine Übersicht Ihres aktuellen Stundenplans.')
+ ];
+ }
+
+ /**
+ * Return the template for the widget.
+ *
+ * @return Flexi_PhpTemplate The template containing the widget contents
+ */
+ public function getPortalTemplate()
+ {
+ $view = CalendarScheduleModel::getUserCalendarView(
+ $GLOBALS['user']->id,
+ false,
+ false,
+ $days = array(0,1,2,3,4)
+ );
+
+ $template = $GLOBALS['template_factory']->open('shared/string');
+ $template->content = CalendarWidgetView::createFromWeekView($view)->render();
+
+ return $template;
+ }
+}
diff --git a/lib/modules/TerminWidget.php b/lib/modules/TerminWidget.php
new file mode 100644
index 0000000..c92f1d2
--- /dev/null
+++ b/lib/modules/TerminWidget.php
@@ -0,0 +1,43 @@
+<?php
+/*
+ * TerminWidget.php - A portal plugin for dates
+ *
+ * Copyright (C) 2014 - André Klaßen <klassen@elan-ev.de>
+ *
+ * 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.
+ */
+
+require_once 'app/controllers/calendar/contentbox.php';
+
+class TerminWidget extends CorePlugin implements PortalPlugin
+{
+ public function getPluginName()
+ {
+ return _('Meine aktuellen Termine');
+ }
+
+ public function getMetadata()
+ {
+ return [
+ 'description' => _('Mit diesem Widget haben Sie ihre aktuellen Termine im Überlick.')
+ ];
+ }
+
+ public function getPortalTemplate()
+ {
+ $dispatcher = new StudipDispatcher();
+ $controller = new Calendar_ContentboxController($dispatcher);
+ $response = $controller->relay('calendar/contentbox/display/'.$GLOBALS['user']->id);
+ $template = $GLOBALS['template_factory']->open('shared/string');
+ $template->content = $response->body;
+
+ $navigation = new Navigation('', 'dispatch.php/calendar/single/week', ['self' => true]);
+ $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Neuen Termin anlegen')]));
+ $template->icons = [$navigation];
+
+ return $template;
+ }
+}