[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorDashboardPanelArchiveController 4 extends PhabricatorDashboardController { 5 6 private $id; 7 8 public function willProcessRequest(array $data) { 9 $this->id = $data['id']; 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $viewer = $request->getUser(); 15 16 $panel = id(new PhabricatorDashboardPanelQuery()) 17 ->setViewer($viewer) 18 ->withIDs(array($this->id)) 19 ->requireCapabilities( 20 array( 21 PhabricatorPolicyCapability::CAN_VIEW, 22 PhabricatorPolicyCapability::CAN_EDIT, 23 )) 24 ->executeOne(); 25 if (!$panel) { 26 return new Aphront404Response(); 27 } 28 29 $next_uri = '/'.$panel->getMonogram(); 30 31 if ($request->isFormPost()) { 32 $xactions = array(); 33 $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 34 ->setTransactionType(PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE) 35 ->setNewValue((int)!$panel->getIsArchived()); 36 37 id(new PhabricatorDashboardPanelTransactionEditor()) 38 ->setActor($viewer) 39 ->setContentSourceFromRequest($request) 40 ->applyTransactions($panel, $xactions); 41 42 return id(new AphrontRedirectResponse())->setURI($next_uri); 43 } 44 45 if ($panel->getIsArchived()) { 46 $title = pht('Activate Panel?'); 47 $body = pht( 48 'This panel will be reactivated and appear in other interfaces as '. 49 'an active panel.'); 50 $submit_text = pht('Activate Panel'); 51 } else { 52 $title = pht('Archive Panel?'); 53 $body = pht( 54 'This panel will be archived and no longer appear in lists of active '. 55 'panels.'); 56 $submit_text = pht('Archive Panel'); 57 } 58 59 return $this->newDialog() 60 ->setTitle($title) 61 ->appendParagraph($body) 62 ->addSubmitButton($submit_text) 63 ->addCancelButton($next_uri); 64 } 65 66 }
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 |