aboutsummaryrefslogtreecommitdiff
path: root/lib/modules/MyCoursesWidget.php
blob: f4f29397d70369aa577f88fc688db5a9f80384d3 (plain)
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
<?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)]);

        return Studip\VueApp::create('MyCourses')
            ->withStore(
                'MyCoursesStore',
                'mycourses',
                $controller->getPortalWidgetData()
            )
            ->getTemplate();
    }
}