phorge/src/applications/people/customfield/PhabricatorUserStatusField.php
epriestley ab636f36bf Rename PhabricatorUserStatus to PhabricatorCalendarEvent
Summary: Ref T4375. We never join this table, so this is a pretty straight find/replace.

Test Plan: Browsed around Calendar, verified that nothing seemed broken. Saw my red dot in other apps.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4375

Differential Revision: https://secure.phabricator.com/D8145
2014-02-06 10:07:29 -08:00

40 lines
775 B
PHP

<?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();
$statuses = id(new PhabricatorCalendarEvent())
->loadCurrentStatuses(array($user->getPHID()));
if (!$statuses) {
return pht('Available');
}
$status = head($statuses);
return $status->getTerseSummary($viewer);
}
}