diff options
| author | Viktoria Wiebe <vwiebe@uni-osnabrueck.de> | 2022-11-21 15:28:19 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-11-21 15:28:19 +0000 |
| commit | c1b760e7b459dec48ff8f730c6bb89ebd05ef371 (patch) | |
| tree | 62e2f6336732bd83eaaa5666aa2a6374db83aa6a /lib/modules | |
| parent | 470d57a844a9d52da3bdafe1266ae0239603458e (diff) | |
implementation of course overview portal widget, fixes #1080
Closes #1080
Merge request studip/studip!757
Diffstat (limited to 'lib/modules')
| -rw-r--r-- | lib/modules/MyCoursesWidget.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/modules/MyCoursesWidget.php b/lib/modules/MyCoursesWidget.php new file mode 100644 index 0000000..81aceed --- /dev/null +++ b/lib/modules/MyCoursesWidget.php @@ -0,0 +1,37 @@ +<?php +/** + * My courses widget. Displays a user's courses on the start page. + * + * @author Viktoria Wiebe <viktoria.wiebe@web.de> + * @license GPL2 or any later version + * @since Stud.IP 5.3 + */ + +require_once 'app/controllers/my_courses.php'; + +class MyCoursesWidget extends CorePlugin implements PortalPlugin +{ + public function getPluginName() + { + return _('Meine Veranstaltungen'); + } + + public function getMetadata() + { + return [ + 'description' => _('Dieses Widget zeigt eine Liste Ihrer Veranstaltungen an.') + ]; + } + + public function getPortalTemplate() + { + // get the MyCoursesController in order to prepare the correct data for the overview + $controller = app(MyCoursesController::class, ['dispatcher' => app(\Trails_Dispatcher::class)]); + $data = $controller->getPortalWidgetData(); + + // add the json data to the head so vue can grab it + PageLayout::addHeadElement('script', [], 'STUDIP.MyCoursesData = ' . json_encode($data) . ';'); + + return $GLOBALS['template_factory']->open('start/my_courses'); + } +} |
