2017-01-11 21:35:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorHomeMenuItemController
|
|
|
|
extends PhabricatorHomeController {
|
|
|
|
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$type = $request->getURIData('type');
|
|
|
|
$custom_phid = null;
|
2017-01-25 18:04:33 +01:00
|
|
|
$menu = PhabricatorProfileMenuEngine::MENU_GLOBAL;
|
2017-01-11 21:35:16 +01:00
|
|
|
if ($type == 'personal') {
|
|
|
|
$custom_phid = $viewer->getPHID();
|
2017-01-25 18:04:33 +01:00
|
|
|
$menu = PhabricatorProfileMenuEngine::MENU_PERSONAL;
|
2017-01-11 21:35:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$application = 'PhabricatorHomeApplication';
|
|
|
|
$home_app = id(new PhabricatorApplicationQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withClasses(array($application))
|
|
|
|
->withInstalled(true)
|
|
|
|
->executeOne();
|
|
|
|
|
|
|
|
$engine = id(new PhabricatorHomeProfileMenuEngine())
|
|
|
|
->setProfileObject($home_app)
|
|
|
|
->setCustomPHID($custom_phid)
|
2017-01-25 18:04:33 +01:00
|
|
|
->setMenuType($menu)
|
2017-01-31 17:58:33 +01:00
|
|
|
->setController($this);
|
2017-01-11 21:35:16 +01:00
|
|
|
|
|
|
|
return $engine->buildResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|