Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117752160
VFreeBusy.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
VFreeBusy.php
View Options
<?php
namespace
Sabre\VObject\Component
;
use
Sabre\VObject
;
/**
* The VFreeBusy component
*
* This component adds functionality to a component, specific for VFREEBUSY
* components.
*
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class
VFreeBusy
extends
VObject\Component
{
/**
* Checks based on the contained FREEBUSY information, if a timeslot is
* available.
*
* @param DateTime $start
* @param Datetime $end
* @return bool
*/
public
function
isFree
(
\DateTime
$start
,
\Datetime
$end
)
{
foreach
(
$this
->
select
(
'FREEBUSY'
)
as
$freebusy
)
{
// We are only interested in FBTYPE=BUSY (the default),
// FBTYPE=BUSY-TENTATIVE or FBTYPE=BUSY-UNAVAILABLE.
if
(
isset
(
$freebusy
[
'FBTYPE'
])
&&
strtoupper
(
substr
((
string
)
$freebusy
[
'FBTYPE'
],
0
,
4
))!==
'BUSY'
)
{
continue
;
}
// The freebusy component can hold more than 1 value, separated by
// commas.
$periods
=
explode
(
','
,
(
string
)
$freebusy
);
foreach
(
$periods
as
$period
)
{
// Every period is formatted as [start]/[end]. The start is an
// absolute UTC time, the end may be an absolute UTC time, or
// duration (relative) value.
list
(
$busyStart
,
$busyEnd
)
=
explode
(
'/'
,
$period
);
$busyStart
=
VObject\DateTimeParser
::
parse
(
$busyStart
);
$busyEnd
=
VObject\DateTimeParser
::
parse
(
$busyEnd
);
if
(
$busyEnd
instanceof
\DateInterval
)
{
$tmp
=
clone
$busyStart
;
$tmp
->
add
(
$busyEnd
);
$busyEnd
=
$tmp
;
}
if
(
$start
<
$busyEnd
&&
$end
>
$busyStart
)
{
return
false
;
}
}
}
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 3:49 AM (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0a/d4/405a004faa0440feb66e22a2a2c0
Default Alt Text
VFreeBusy.php (1 KB)
Attached To
Mode
rRPK roundcubemail-plugins-kolab
Attached
Detach File
Event Timeline