2013-07-10 21:34:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorUserStatusField
|
|
|
|
extends PhabricatorUserCustomField {
|
|
|
|
|
|
|
|
private $value;
|
|
|
|
|
|
|
|
public function getFieldKey() {
|
|
|
|
return 'user:status';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldName() {
|
|
|
|
return pht('Status');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldDescription() {
|
|
|
|
return pht('Shows when a user is away or busy.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAppearInPropertyView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderPropertyViewValue() {
|
|
|
|
$user = $this->getObject();
|
|
|
|
$viewer = $this->requireViewer();
|
|
|
|
|
2014-02-06 19:07:29 +01:00
|
|
|
$statuses = id(new PhabricatorCalendarEvent())
|
2013-07-10 21:34:09 +02:00
|
|
|
->loadCurrentStatuses(array($user->getPHID()));
|
|
|
|
if (!$statuses) {
|
|
|
|
return pht('Available');
|
|
|
|
}
|
|
|
|
|
|
|
|
$status = head($statuses);
|
|
|
|
|
|
|
|
return $status->getTerseSummary($viewer);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|