1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00
phorge-phorge/src/applications/people/controller/PhabricatorPeopleProfileController.php

64 lines
1.3 KiB
PHP
Raw Normal View History

2011-01-24 03:09:16 +01:00
<?php
abstract class PhabricatorPeopleProfileController
extends PhabricatorPeopleController {
2011-01-24 03:09:16 +01:00
private $user;
private $profileMenu;
public function shouldRequireAdmin() {
return false;
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function getUser() {
return $this->user;
}
public function buildApplicationMenu() {
$menu = $this->newApplicationMenu();
$profile_menu = $this->getProfileMenu();
if ($profile_menu) {
$menu->setProfileMenu($profile_menu);
}
return $menu;
}
protected function getProfileMenu() {
if (!$this->profileMenu) {
$user = $this->getUser();
if ($user) {
$viewer = $this->getViewer();
$engine = id(new PhabricatorPeopleProfilePanelEngine())
->setViewer($viewer)
->setProfileObject($user);
$this->profileMenu = $engine->buildNavigation();
}
}
return $this->profileMenu;
}
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$user = $this->getUser();
if ($user) {
$crumbs->addTextCrumb(
$user->getUsername(),
urisprintf('/p/%s/', $user->getUsername()));
}
return $crumbs;
}
2011-01-24 03:09:16 +01:00
}