aboutsummaryrefslogtreecommitdiff
path: root/lib/modules/CoreEvaluation.php
blob: 266af6e988c5b1f2cea08cfeab416df7ae9d5e88 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php

/*
 *  Copyright (c) 2026  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 CoreEvaluation extends CorePlugin implements StudipModuleExtended
{
    use IconNavigationTrait;

    public function getManyIconNavigation(array $course_ids, ?string $user_id = null): array
    {
        if (!$this->isTabActive()) {
            return [];
        }

        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getTabNavigation($course_id)
    {
        if (!$this->isTabActive()) {
            return null;
        }

        $navigation = new Navigation(_('Evaluation'), 'dispatch.php/course/evaluation');
        $navigation->setImage(Icon::create('evaluation', Icon::ROLE_INFO_ALT));
        $navigation->setActiveImage(Icon::create('evaluation', Icon::ROLE_INFO));

        return ['evaluation' => $navigation];
    }

    /**
     * {@inheritdoc}
     */
    public function getMetadata()
    {
        return [
            'summary' => _('Lehrveranstaltungs-Evaluationen'),
            'description' => _(''),
            'displayname' => _('Evaluation'),
            'category' => _('Lehr- und Lernorganisation'),
            'keywords' => _(''),
            'descriptionshort' => _(''),
            'descriptionlong' => _(''),
            'icon' => Icon::create('evaluation', Icon::ROLE_INFO),
            'icon_clickable' => Icon::create('evaluation'),
//            'screenshots' => [
//                'path' => 'assets/images/plus/screenshots/Informationen',
//                'pictures' => [
//                    0 => ['source' => 'Zwei_Eintraege_mit_Inhalten_zur_Verfuegung_stellen.jpg', 'title' => _('Zwei Einträge mit Inhalten zur Verfügung stellen')],
//                    1 => ['source' => 'Neue_Informationsseite_anlegen.jpg', 'title' => _('Neue Informationsseite anlegen')],
//                    2 => ['source' => 'Informationsseite_bearbeiten.jpg', 'title' => _('Informationsseite bearbeiten')]
//                ]
//            ]
        ];
    }

    public function getInfoTemplate($course_id)
    {
        return null;
    }

    public function isTabActive(): bool
    {
        $evaluation = Questionnaire::findOneBySQL(
            "INNER JOIN `questionnaire_eval_assignments` USING (`questionnaire_id`)
            WHERE `course_id` = ? AND `applied` = 1
            ORDER BY `questionnaires`.`startdate`",
            [Context::getId()]);
        return PluginManager::getInstance()->getPlugin(CoreEvaluation::class) && $evaluation &&
                (User::findCurrent()->hasPermissionLevel('tutor', Context::get()) ||
                $evaluation->startdate <= time());
    }
}