[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorCountdownDeleteController 4 extends PhabricatorCountdownController { 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 $user = $request->getUser(); 15 16 $countdown = id(new PhabricatorCountdownQuery()) 17 ->setViewer($user) 18 ->withIDs(array($this->id)) 19 ->requireCapabilities( 20 array( 21 PhabricatorPolicyCapability::CAN_VIEW, 22 PhabricatorPolicyCapability::CAN_EDIT, 23 )) 24 ->executeOne(); 25 26 if (!$countdown) { 27 return new Aphront404Response(); 28 } 29 30 if ($request->isFormPost()) { 31 $countdown->delete(); 32 return id(new AphrontRedirectResponse()) 33 ->setURI('/countdown/'); 34 } 35 36 $inst = pht('Are you sure you want to delete the countdown %s?', 37 $countdown->getTitle()); 38 39 $dialog = new AphrontDialogView(); 40 $dialog->setUser($request->getUser()); 41 $dialog->setTitle(pht('Really delete this countdown?')); 42 $dialog->appendChild(phutil_tag('p', array(), $inst)); 43 $dialog->addSubmitButton(pht('Delete')); 44 $dialog->addCancelButton('/countdown/'); 45 $dialog->setSubmitURI($request->getPath()); 46 47 return id(new AphrontDialogResponse())->setDialog($dialog); 48 } 49 50 }
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 |