3 final class PhabricatorPeopleProfileMenuEngine
4 extends PhabricatorProfileMenuEngine
{
6 const ITEM_PROFILE
= 'people.profile';
7 const ITEM_MANAGE
= 'people.manage';
8 const ITEM_PICTURE
= 'people.picture';
9 const ITEM_BADGES
= 'people.badges';
10 const ITEM_TASKS
= 'people.tasks';
11 const ITEM_COMMITS
= 'people.commits';
12 const ITEM_REVISIONS
= 'people.revisions';
14 protected function isMenuEngineConfigurable() {
18 public function getItemURI($path) {
19 $user = $this->getProfileObject();
20 $username = $user->getUsername();
21 $username = phutil_escape_uri($username);
22 return "/p/{$username}/item/{$path}";
25 protected function getBuiltinProfileItems($object) {
26 $viewer = $this->getViewer();
30 $items[] = $this->newItem()
31 ->setBuiltinKey(self
::ITEM_PICTURE
)
32 ->setMenuItemKey(PhabricatorPeoplePictureProfileMenuItem
::MENUITEMKEY
);
34 $items[] = $this->newItem()
35 ->setBuiltinKey(self
::ITEM_PROFILE
)
36 ->setMenuItemKey(PhabricatorPeopleDetailsProfileMenuItem
::MENUITEMKEY
);
38 $have_badges = PhabricatorApplication
::isClassInstalledForViewer(
39 'PhabricatorBadgesApplication',
42 $items[] = $this->newItem()
43 ->setBuiltinKey(self
::ITEM_BADGES
)
44 ->setMenuItemKey(PhabricatorPeopleBadgesProfileMenuItem
::MENUITEMKEY
);
47 $have_maniphest = PhabricatorApplication
::isClassInstalledForViewer(
48 'PhabricatorManiphestApplication',
50 if ($have_maniphest) {
51 $items[] = $this->newItem()
52 ->setBuiltinKey(self
::ITEM_TASKS
)
53 ->setMenuItemKey(PhabricatorPeopleTasksProfileMenuItem
::MENUITEMKEY
);
56 $have_differential = PhabricatorApplication
::isClassInstalledForViewer(
57 'PhabricatorDifferentialApplication',
59 if ($have_differential) {
60 $items[] = $this->newItem()
61 ->setBuiltinKey(self
::ITEM_REVISIONS
)
63 PhabricatorPeopleRevisionsProfileMenuItem
::MENUITEMKEY
);
66 $have_diffusion = PhabricatorApplication
::isClassInstalledForViewer(
67 'PhabricatorDiffusionApplication',
69 if ($have_diffusion) {
70 $items[] = $this->newItem()
71 ->setBuiltinKey(self
::ITEM_COMMITS
)
72 ->setMenuItemKey(PhabricatorPeopleCommitsProfileMenuItem
::MENUITEMKEY
);
75 $items[] = $this->newItem()
76 ->setBuiltinKey(self
::ITEM_MANAGE
)
77 ->setMenuItemKey(PhabricatorPeopleManageProfileMenuItem
::MENUITEMKEY
);