3 abstract class PhabricatorPeopleProfileController
4 extends PhabricatorPeopleController
{
8 public function shouldRequireAdmin() {
12 public function setUser(PhabricatorUser
$user) {
17 public function getUser() {
21 protected function buildApplicationCrumbs() {
22 $crumbs = parent
::buildApplicationCrumbs();
24 $user = $this->getUser();
26 $crumbs->addTextCrumb(
28 urisprintf('/p/%s/', $user->getUsername()));
34 public function buildProfileHeader() {
36 $viewer = $this->getViewer();
38 $profile = $user->loadUserProfile();
39 $picture = $user->getProfileImageURI();
41 $profile_icon = PhabricatorPeopleIconSet
::getIconIcon($profile->getIcon());
42 $profile_title = $profile->getDisplayTitle();
45 $tag = id(new PHUITagView())
46 ->setType(PHUITagView
::TYPE_SHADE
);
49 if ($user->getIsAdmin()) {
50 $tags[] = id(clone $tag)
51 ->setName(pht('Administrator'))
55 // "Disabled" gets a stronger status tag below.
57 if (!$user->getIsApproved()) {
58 $tags[] = id(clone $tag)
59 ->setName('Not Approved')
63 if ($user->getIsSystemAgent()) {
64 $tags[] = id(clone $tag)
69 if ($user->getIsMailingList()) {
70 $tags[] = id(clone $tag)
71 ->setName(pht('Mailing List'))
75 if (!$user->getIsEmailVerified()) {
76 $tags[] = id(clone $tag)
77 ->setName(pht('Email Not Verified'))
81 $header = id(new PHUIHeaderView())
82 ->setHeader($user->getFullName())
84 ->setProfileHeader(true)
85 ->addClass('people-profile-header');
87 foreach ($tags as $tag) {
88 $header->addTag($tag);
91 require_celerity_resource('project-view-css');
93 if ($user->getIsDisabled()) {
94 $header->setStatus('fa-ban', 'red', pht('Disabled'));
96 $header->setStatus($profile_icon, 'bluegrey', $profile_title);
99 $can_edit = PhabricatorPolicyFilter
::hasCapability(
102 PhabricatorPolicyCapability
::CAN_EDIT
);
105 $id = $user->getID();
106 $header->setImageEditURL($this->getApplicationURI("picture/{$id}/"));
112 final protected function newNavigation(
113 PhabricatorUser
$user,
116 $viewer = $this->getViewer();
118 $engine = id(new PhabricatorPeopleProfileMenuEngine())
120 ->setController($this)
121 ->setProfileObject($user);
123 $view_list = $engine->newProfileMenuItemViewList();
125 $view_list->setSelectedViewWithItemIdentifier($item_identifier);
127 $navigation = $view_list->newNavigationView();