[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class SubscriptionListDialogBuilder { 4 5 private $viewer; 6 private $handles; 7 private $objectPHID; 8 private $title; 9 10 public function setViewer(PhabricatorUser $viewer) { 11 $this->viewer = $viewer; 12 return $this; 13 } 14 15 public function getViewer() { 16 return $this->viewer; 17 } 18 19 public function setHandles(array $handles) { 20 assert_instances_of($handles, 'PhabricatorObjectHandle'); 21 $this->handles = $handles; 22 return $this; 23 } 24 25 public function getHandles() { 26 return $this->handles; 27 } 28 29 public function setObjectPHID($object_phid) { 30 $this->objectPHID = $object_phid; 31 return $this; 32 } 33 34 public function getObjectPHID() { 35 return $this->objectPHID; 36 } 37 38 public function setTitle($title) { 39 $this->title = $title; 40 return $this; 41 } 42 43 public function getTitle() { 44 return $this->title; 45 } 46 47 public function buildDialog() { 48 $phid = $this->getObjectPHID(); 49 $handles = $this->getHandles(); 50 $object_handle = $handles[$phid]; 51 unset($handles[$phid]); 52 53 return id(new AphrontDialogView()) 54 ->setUser($this->getViewer()) 55 ->setWidth(AphrontDialogView::WIDTH_FORM) 56 ->setFlush(true) 57 ->setTitle($this->getTitle()) 58 ->appendChild($this->buildBody($this->getViewer(), $handles)) 59 ->addCancelButton($object_handle->getURI(), pht('Close')); 60 } 61 62 private function buildBody(PhabricatorUser $viewer, array $handles) { 63 64 $list = id(new PHUIObjectItemListView()) 65 ->setUser($viewer) 66 ->setStackable(true); 67 foreach ($handles as $handle) { 68 $item = id(new PHUIObjectItemView()) 69 ->setHeader($handle->getFullName()) 70 ->setHref($handle->getURI()) 71 ->setDisabled($handle->isDisabled()); 72 73 if ($handle->getImageURI()) { 74 $item->setImageURI($handle->getImageURI()); 75 } 76 77 $list->addItem($item); 78 } 79 80 return $list; 81 } 82 83 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |