Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/view/PhabricatorUserCardView.php
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | protected function getTagContent() { | ||||
| $user = $this->profile; | $user = $this->profile; | ||||
| $profile = $user->loadUserProfile(); | $profile = $user->loadUserProfile(); | ||||
| $picture = $user->getProfileImageURI(); | $picture = $user->getProfileImageURI(); | ||||
| $viewer = $this->viewer; | $viewer = $this->viewer; | ||||
| require_celerity_resource('project-card-view-css'); | require_celerity_resource('project-card-view-css'); | ||||
| $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); | // We don't have a ton of room on the hovercard, so we're trying to show | ||||
| $profile_title = $profile->getDisplayTitle(); | // the most important tag. Users can click through to the profile to get | ||||
| // more details. | |||||
| if ($user->getIsDisabled()) { | |||||
| $tag_icon = 'fa-ban'; | |||||
| $tag_title = pht('Disabled'); | |||||
| $tag_shade = PHUITagView::COLOR_RED; | |||||
| } else if (!$user->getIsApproved()) { | |||||
| $tag_icon = 'fa-ban'; | |||||
| $tag_title = pht('Unapproved Account'); | |||||
| $tag_shade = PHUITagView::COLOR_RED; | |||||
| } else if (!$user->getIsEmailVerified()) { | |||||
| $tag_icon = 'fa-envelope'; | |||||
| $tag_title = pht('Email Not Verified'); | |||||
| $tag_shade = PHUITagView::COLOR_RED; | |||||
| } else if ($user->getIsAdmin()) { | |||||
| $tag_icon = 'fa-star'; | |||||
| $tag_title = pht('Administrator'); | |||||
| $tag_shade = PHUITagView::COLOR_INDIGO; | |||||
| } else { | |||||
| $tag_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); | |||||
| $tag_title = $profile->getDisplayTitle(); | |||||
| $tag_shade = null; | |||||
| } | |||||
| $tag = id(new PHUITagView()) | $tag = id(new PHUITagView()) | ||||
| ->setIcon($profile_icon) | ->setIcon($tag_icon) | ||||
| ->setName($profile_title) | ->setName($tag_title) | ||||
| ->addClass('project-view-header-tag') | |||||
| ->setType(PHUITagView::TYPE_SHADE); | ->setType(PHUITagView::TYPE_SHADE); | ||||
| if ($tag_shade !== null) { | |||||
| $tag->setShade($tag_shade); | |||||
| } | |||||
| $header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
| ->setHeader(array($user->getFullName(), $tag)) | ->setHeader($user->getFullName()) | ||||
| ->addTag($tag) | |||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setImage($picture); | ->setImage($picture); | ||||
| $body = array(); | $body = array(); | ||||
| $body[] = $this->addItem( | $body[] = $this->addItem( | ||||
| pht('User Since'), | pht('User Since'), | ||||
| phabricator_date($profile->getDateCreated(), $viewer)); | phabricator_date($user->getDateCreated(), $viewer)); | ||||
| if (PhabricatorApplication::isClassInstalledForViewer( | if (PhabricatorApplication::isClassInstalledForViewer( | ||||
| 'PhabricatorCalendarApplication', | 'PhabricatorCalendarApplication', | ||||
| $viewer)) { | $viewer)) { | ||||
| $body[] = $this->addItem( | $body[] = $this->addItem( | ||||
| pht('Availability'), | pht('Availability'), | ||||
| id(new PHUIUserAvailabilityView()) | id(new PHUIUserAvailabilityView()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines | |||||