Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php
12256 views
1
<?php
2
3
final class PhabricatorPeopleAvailabilitySearchEngineAttachment
4
extends PhabricatorSearchEngineAttachment {
5
6
public function getAttachmentName() {
7
return pht('User Availability');
8
}
9
10
public function getAttachmentDescription() {
11
return pht('Get availability information for users.');
12
}
13
14
public function willLoadAttachmentData($query, $spec) {
15
$query->needAvailability(true);
16
}
17
18
public function getAttachmentForObject($object, $data, $spec) {
19
20
$until = $object->getAwayUntil();
21
if ($until) {
22
$until = (int)$until;
23
} else {
24
$until = null;
25
}
26
27
$value = $object->getDisplayAvailability();
28
if ($value === null) {
29
$value = PhabricatorCalendarEventInvitee::AVAILABILITY_AVAILABLE;
30
}
31
32
$name = PhabricatorCalendarEventInvitee::getAvailabilityName($value);
33
$color = PhabricatorCalendarEventInvitee::getAvailabilityColor($value);
34
35
$event_phid = $object->getAvailabilityEventPHID();
36
37
return array(
38
'value' => $value,
39
'until' => $until,
40
'name' => $name,
41
'color' => $color,
42
'eventPHID' => $event_phid,
43
);
44
}
45
46
}
47
48