Initial upload to Gitea
This commit is contained in:
1 parent
78193254ad
commit
8478998cae
1485 files changed
+461025
-42348
No files matched your search
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright 2020 - 2026 grommunio GmbH
|
||||
* SPDX-FileCopyrightText: Copyright 2016 Kopano and its licensors
|
||||
* SPDX-FileCopyrightText: Copyright 2005 - 2016 Zarafa B.V. and its licensors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* BusyTime Module.
|
||||
*/
|
||||
require_once BASE_PATH . 'server/includes/modules/class.appointmentlistmodule.php';
|
||||
|
||||
class BusyTimeListModule extends AppointmentListModule {
|
||||
/**
|
||||
* @var array the properties sent back to the client - a minimal set of data
|
||||
*/
|
||||
private $minproperties;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $id unique id
|
||||
* @param array $data list of all actions
|
||||
*/
|
||||
public function __construct($id, $data) {
|
||||
parent::__construct($id, $data);
|
||||
$this->minproperties = $GLOBALS["properties"]->getBusyTimeProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the notifiers for this module,
|
||||
* and register them to the Bus.
|
||||
*/
|
||||
#[Override]
|
||||
public function createNotifiers() {
|
||||
// Keep empty, the BusyTimeListModule doesn't need notifiers.
|
||||
}
|
||||
|
||||
/**
|
||||
* Process calendar items to prepare them for being sent back to the client.
|
||||
*
|
||||
* @param array $calendaritems array of appointments retrieved from the mapi tablwe
|
||||
* @param object $store message store
|
||||
* @param mixed $entryid
|
||||
* @param int $start startdate of the interval
|
||||
* @param int $end enddate of the interval
|
||||
*
|
||||
* @return array $items processed items
|
||||
*/
|
||||
#[Override]
|
||||
public function processItems($calendaritems, $store, $entryid, $start, $end) {
|
||||
$items = [];
|
||||
foreach ($calendaritems as $calendaritem) {
|
||||
if (isset($calendaritem[$this->properties["recurring"]]) && $calendaritem[$this->properties["recurring"]]) {
|
||||
$recurrence = new Recurrence($store, $calendaritem);
|
||||
try {
|
||||
$recuritems = $recurrence->getItems($start, $end);
|
||||
}
|
||||
catch (RecurrenceException $re) {
|
||||
$subject = $calendaritem[$this->properties["subject"]] ?? '<empty subject>';
|
||||
error_log(sprintf(
|
||||
"processItems (busytimelist) RecurrenceException (%d) for item '%s' - %s - %s",
|
||||
$re->getCode(),
|
||||
$subject,
|
||||
bin2hex($calendaritem[$this->properties["entryid"]]),
|
||||
bin2hex($calendaritem[$this->properties["recurring_data"]])
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($recuritems as $recuritem) {
|
||||
$item = Conversion::mapMAPI2XML($this->minproperties, $recuritem);
|
||||
|
||||
// only add it in response if its not removed by above function
|
||||
if (!empty($item)) {
|
||||
array_push($items, $item['props']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$item = Conversion::mapMAPI2XML($this->minproperties, $calendaritem);
|
||||
|
||||
// only add it in response if its not removed by above function
|
||||
if (!empty($item)) {
|
||||
array_push($items, $item['props']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user