1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/src/applications/people/customfield/PhabricatorUserStatusField.php
Joshua Spence 86c399b657 Rename PhabricatorApplication subclasses
Summary: Ref T5655. Some discussion in D9839. Generally speaking, `Phabricator{$name}Application` is clearer than `PhabricatorApplication{$name}`.

Test Plan:
# Pinned and uninstalled some applications.
# Applied patch and performed migrations.
# Verified that the pinned applications were still pinned and that the uninstalled applications were still uninstalled.
# Performed a sanity check on the database contents.

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: hach-que, epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D9982
2014-07-23 10:03:09 +10:00

44 lines
925 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 isFieldEnabled() {
return PhabricatorApplication::isClassInstalled(
'PhabricatorCalendarApplication');
}
public function renderPropertyViewValue(array $handles) {
$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);
}
}