aboutsummaryrefslogtreecommitdiff
path: root/lib/modules/MyStudygroupsWidget.php
blob: 170941914b187d8b787ee3f70298bea8606c45c0 (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
<?php
/**
 * My Study group widget. Displays a list of own study groups
 *
 * @author
 * @license GPL2 or any later version
 * @since   Stud.IP 6.0
 */
class MyStudygroupsWidget extends CorePlugin implements PortalPlugin
{
    public function getPluginName()
    {
        return _('Meine Studiengruppen');
    }

    public function getMetadata()
    {
        return [
            'description' => _('Dieses Widget zeigt eine Liste Ihrer Studiengruppen an.')
        ];
    }

    public function getPortalTemplate()
    {
        $template = $GLOBALS['template_factory']->open('start/my_studygroups');

        $controller = app(\Trails\Dispatcher::class)->load_controller('my_studygroups');
        $response = $controller->relayWithRedirect('my_studygroups/index/true');
        $template->content = $response->body;

        $navigation = new Navigation('', 'dispatch.php/course/wizard?studygroup=1');
        $navigation->setImage(Icon::create('add', Icon::ROLE_CLICKABLE, ['title' => _('Neue Studiengruppe anlegen')]));
        $navigation->setLinkAttributes(['data-dialog' => 'reload-on-close']);
        $template->icons = [$navigation];

        return $template;
    }
}