aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Models/Studip.php
blob: 1b5aed05124d82f19e38c48ea5a3f9c959110a20 (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
<?php

namespace JsonApi\Models;

class Studip
{
    public function getId()
    {
        return 'studip';
    }

    public function getProperties()
    {
        $properties = [
            new StudipProperty('studip-version', 'Stud.IP-Version', $GLOBALS['SOFTWARE_VERSION']),
            new StudipProperty('oer-campus-enabled', 'OERCAMPUS_ENABLED', \Config::get()->OERCAMPUS_ENABLED),
            new StudipProperty('oer-enable-suggestions', 'OER_ENABLE_SUGGESTIONS', \Config::get()->OER_ENABLE_SUGGESTIONS),
        ];

        $copyrightDialog = self::getConfigOption('COPYRIGHT_DIALOG_ON_UPLOAD');
        if ($copyrightDialog) {
            $properties[] = $copyrightDialog;
        }

        return $properties;
    }

    private static function getConfigOption($field)
    {
        $config = \Config::get();

        if (!isset($config[$field])) {
            return null;
        }

        $description = $config->getMetadata($field)['description'];
        $value = $config->getValue($field);

        return new StudipProperty($field, $description, $value);
    }
}