|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* BusyTime Module |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
require_once(BASE_PATH . 'server/includes/mapi/class.recurrence.php'); // FIXME: included by appointmentlistmodule |
|
7
|
|
|
require_once(BASE_PATH . 'server/includes/modules/class.appointmentlistmodule.php'); |
|
8
|
|
|
|
|
9
|
|
|
class BusyTimeListModule extends AppointmentListModule |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @var array the properties sent back to the client - a minimal set of data |
|
13
|
|
|
*/ |
|
14
|
|
|
private $minproperties; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Constructor |
|
18
|
|
|
* @param int $id unique id. |
|
19
|
|
|
* @param array $data list of all actions. |
|
20
|
|
|
*/ |
|
21
|
|
|
function __construct($id, $data) |
|
22
|
|
|
{ |
|
23
|
|
|
parent::__construct($id, $data); |
|
24
|
|
|
$this->minproperties = $GLOBALS["properties"]->getBusyTimeProperties(); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Creates the notifiers for this module, |
|
29
|
|
|
* and register them to the Bus. |
|
30
|
|
|
*/ |
|
31
|
|
|
function createNotifiers() |
|
32
|
|
|
{ |
|
33
|
|
|
// Keep empty, the BusyTimeListModule doesn't need notifiers. |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Process calendar items to prepare them for being sent back to the client |
|
38
|
|
|
* @param array $calendaritems array of appointments retrieved from the mapi tablwe |
|
39
|
|
|
* @param object $store message store |
|
40
|
|
|
* @param object $calendar folder |
|
41
|
|
|
* @param date $start startdate of the interval |
|
42
|
|
|
* @param date $end enddate of the interval |
|
43
|
|
|
* @return array $items processed items |
|
44
|
|
|
*/ |
|
45
|
|
|
function processItems($calendaritems, $store, $entryid, $start, $end) |
|
46
|
|
|
{ |
|
47
|
|
|
$items = Array(); |
|
48
|
|
|
foreach($calendaritems as $calendaritem) |
|
49
|
|
|
{ |
|
50
|
|
|
if (isset($calendaritem[$this->properties["recurring"]]) && $calendaritem[$this->properties["recurring"]]) { |
|
51
|
|
|
$recurrence = new Recurrence($store, $calendaritem); |
|
|
|
|
|
|
52
|
|
|
$recuritems = $recurrence->getItems($start, $end); |
|
53
|
|
|
|
|
54
|
|
|
foreach($recuritems as $recuritem) |
|
55
|
|
|
{ |
|
56
|
|
|
$item = Conversion::mapMAPI2XML($this->minproperties, $recuritem); |
|
57
|
|
|
|
|
58
|
|
|
// only add it in response if its not removed by above function |
|
59
|
|
|
if(!empty($item)) { |
|
60
|
|
|
array_push($items, $item['props']); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
} else { |
|
64
|
|
|
$item = Conversion::mapMAPI2XML($this->minproperties, $calendaritem); |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
|
|
68
|
|
|
// only add it in response if its not removed by above function |
|
69
|
|
|
if(!empty($item)) { |
|
70
|
|
|
array_push($items,$item['props']); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
return $items; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
?> |
|
|
|
|
|
|
79
|
|
|
|