aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/Range.interface.php
blob: 97aa074c32d29a7cf435366c4b299ee04276eabd (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
<?php
/**
 * Generic range interface. Ranges may be a lot of things in Stud.IP.
 *
 * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
 * @license GPL2 or any later version
 */
interface Range
{
    /**
     * Returns a descriptive text for the range type.
     *
     * @return string
     */
    public function describeRange();

    /**
     * Returns a unique identificator for the range type.
     *
     * @return string
     */
    public function getRangeType();

    /**
     * Returns the id of the current range
     *
     * @return mixed (string|int)
     */
    public function getRangeId();

    /**
     * Returns the full name of the range (in given format).
     *
     * @param  string $format
     * @return string
     */
    public function getFullName($format = 'default');

    /**
     * Returns the configuration object for this range.
     * @return RangeConfig
     */
    public function getConfiguration();

    /**
     * Decides whether the user may access the range.
     *
     * @param string|null $user_id Optional id of a user, defaults to current user
     * @return bool
     */
    public function isAccessibleToUser($user_id = null);

    /**
     * Decides whether the user may edit/alter the range.
     *
     * @param string|null $user_id Optional id of a user, defaults to current user
     * @return bool
     */
    public function isEditableByUser($user_id = null);


    /**
     * @return string A string representation of the Range instance.
     */
    public function __toString() : string;
}