3 final class PhabricatorProjectsCurtainExtension
4 extends PHUICurtainExtension
{
6 const EXTENSIONKEY
= 'projects.projects';
8 public function shouldEnableForObject($object) {
9 return ($object instanceof PhabricatorProjectInterface
);
12 public function getExtensionApplication() {
13 return new PhabricatorProjectApplication();
16 public function buildCurtainPanel($object) {
17 $viewer = $this->getViewer();
19 $project_phids = PhabricatorEdgeQuery
::loadDestinationPHIDs(
21 PhabricatorProjectObjectHasProjectEdgeType
::EDGECONST
);
23 $has_projects = (bool)$project_phids;
24 $project_phids = array_reverse($project_phids);
25 $handles = $viewer->loadHandles($project_phids);
27 // If this object can appear on boards, build the workboard annotations.
28 // Some day, this might be a generic interface. For now, only tasks can
30 $can_appear_on_boards = ($object instanceof ManiphestTask
);
32 $annotations = array();
33 if ($has_projects && $can_appear_on_boards) {
34 $engine = id(new PhabricatorBoardLayoutEngine())
36 ->setBoardPHIDs($project_phids)
37 ->setObjectPHIDs(array($object->getPHID()))
40 // TDOO: Generalize this UI and move it out of Maniphest.
41 require_celerity_resource('maniphest-task-summary-css');
43 foreach ($project_phids as $project_phid) {
44 $handle = $handles[$project_phid];
46 $columns = $engine->getObjectColumns(
50 $annotation = array();
51 foreach ($columns as $column) {
52 $project_id = $column->getProject()->getID();
54 $column_name = pht('(%s)', $column->getDisplayName());
55 $column_link = phutil_tag(
58 'href' => $column->getWorkboardURI(),
59 'class' => 'maniphest-board-link',
63 $annotation[] = $column_link;
67 $annotations[$project_phid] = array(
69 phutil_implode_html(', ', $annotation),
77 $list = id(new PHUIHandleTagListView())
78 ->setHandles($handles)
79 ->setAnnotations($annotations)
80 ->setShowHovercards(true);
82 $list = phutil_tag('em', array(), pht('None'));
85 return $this->newPanel()
86 ->setHeaderText(pht('Tags'))