aboutsummaryrefslogtreecommitdiff
path: root/lib/calendar/EventSource.interface.php
blob: 48506d7ba7c42f3cfa16792f88196a5615d2a72d (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
<?php


namespace Studip\Calendar;


/**
 * This interface defines methods that can be implemented by classes
 * that can provide calendar event data in a standardised format.
 * The methods are meant to be called on a "per-object base",
 * meaning that filtering of the event sources has to be done
 * before calling methods of this interface.
 */
interface EventSource
{
    /**
     * Returns all event data this event source can provide.
     *
     * @returns EventData[] An array of Studip\Calendar\EventData objects.
     */
    public function getAllEventData();


    /**
     * Returns event data that fall in the specified time range.
     *
     * @returns EventData[] An array of Studip\Calendar\EventData objects.
     */
    public function getEventDataForTimeRange(\DateTime $begin, \DateTime $end);


    /**
     * Allows a filtered output of event data based on a specified user,
     * a specified range-ID and range type (must be supported by the
     * Context class) or a specified time range.
     * If no filters are applied the result should be the same as if
     * the getAllEventData method from this interface is called.
     *
     * @param string $user_id The user for whom the event data shall be
     *     retrieved. Depending on the implementation, this parameter
     *     might be necessary to check permissions for event objects.
     *
     * @param string $range_id An optional range-ID that may be necessary
     *     for an implementation to check for permissions.
     *
     * @param string $range_type An optional range type that may be
     *     necessary for an implementation to check for permissions.
     *
     * @param DateTime|int|string $begin The begin date as DateTime object
     *     or unix timestamp.
     *
     * @param DateTime|int|string $end The end date as DateTime object
     *     or unix timestamp.
     *
     * @returns EventData[] An array of Studip\Calendar\EventData objects.
     */
    public function getFilteredEventData(
        $user_id = null,
        $range_id = null,
        $range_type = null,
        $begin = null,
        $end = null
    );
}