aboutsummaryrefslogtreecommitdiff
path: root/lib/models/AdmissionRuleCompatibility.php
blob: 76b2f5763c368d224ecd8d98bfa1859fea7d3229 (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
<?php
/**
 * AdmissionRuleCompatibility.php
 * model class for table admissionrule_compat
 *
 * 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.
 *
 * @author      Thomas Hackl <thomas.hackl@uni-passau.de>
 * @copyright   2016 Stud.IP Core-Group
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 * @category    Stud.IP
 * @since       3.5
 *
 * @property array $id alias for pk
 * @property string $rule_type database column
 * @property string $compat_rule_type database column
 * @property int $mkdate database column
 * @property int $chdate database column
 */
class AdmissionRuleCompatibility extends SimpleORMap
{

    protected static function configure($config = [])
    {
        $config['db_table'] = 'admissionrule_compat';
        parent::configure($config);
    }

    public static function getCompatibilityMatrix()
    {
        $types = AdmissionRule::getAvailableAdmissionRules(false);

        $matrix = [];
        foreach ($types as $class => $data) {
            $compat = self::findByRule_type($class);

            foreach ($compat as $c) {
                $matrix[$class][] = $c->compat_rule_type;
            }
        }

        return $matrix;
    }

}