[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhluxViewController extends PhluxController { 4 5 private $key; 6 7 public function willProcessRequest(array $data) { 8 $this->key = $data['key']; 9 } 10 11 public function processRequest() { 12 $request = $this->getRequest(); 13 $user = $request->getUser(); 14 15 $var = id(new PhluxVariableQuery()) 16 ->setViewer($user) 17 ->withKeys(array($this->key)) 18 ->executeOne(); 19 20 if (!$var) { 21 return new Aphront404Response(); 22 } 23 24 $crumbs = $this->buildApplicationCrumbs(); 25 26 $title = $var->getVariableKey(); 27 28 $crumbs->addTextCrumb($title, $request->getRequestURI()); 29 30 $header = id(new PHUIHeaderView()) 31 ->setHeader($title) 32 ->setUser($user) 33 ->setPolicyObject($var); 34 35 $actions = id(new PhabricatorActionListView()) 36 ->setUser($user) 37 ->setObjectURI($request->getRequestURI()) 38 ->setObject($var); 39 40 $can_edit = PhabricatorPolicyFilter::hasCapability( 41 $user, 42 $var, 43 PhabricatorPolicyCapability::CAN_EDIT); 44 45 $actions->addAction( 46 id(new PhabricatorActionView()) 47 ->setIcon('fa-pencil') 48 ->setName(pht('Edit Variable')) 49 ->setHref($this->getApplicationURI('/edit/'.$var->getVariableKey().'/')) 50 ->setDisabled(!$can_edit) 51 ->setWorkflow(!$can_edit)); 52 53 $display_value = json_encode($var->getVariableValue()); 54 55 $properties = id(new PHUIPropertyListView()) 56 ->setUser($user) 57 ->setObject($var) 58 ->setActionList($actions) 59 ->addProperty(pht('Value'), $display_value); 60 61 $xactions = id(new PhluxTransactionQuery()) 62 ->setViewer($user) 63 ->withObjectPHIDs(array($var->getPHID())) 64 ->execute(); 65 66 $engine = id(new PhabricatorMarkupEngine()) 67 ->setViewer($user); 68 69 $xaction_view = id(new PhabricatorApplicationTransactionView()) 70 ->setUser($user) 71 ->setObjectPHID($var->getPHID()) 72 ->setTransactions($xactions) 73 ->setMarkupEngine($engine); 74 75 $object_box = id(new PHUIObjectBoxView()) 76 ->setHeader($header) 77 ->addPropertyList($properties); 78 79 return $this->buildApplicationPage( 80 array( 81 $crumbs, 82 $object_box, 83 $xaction_view, 84 ), 85 array( 86 'title' => $title, 87 )); 88 } 89 90 }
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 |