[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorCalendarEventDeleteController 4 extends PhabricatorCalendarController { 5 6 private $id; 7 8 public function willProcessRequest(array $data) { 9 $this->id = idx($data, 'id'); 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $user = $request->getUser(); 15 16 $status = id(new PhabricatorCalendarEventQuery()) 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 (!$status) { 27 return new Aphront404Response(); 28 } 29 30 if ($request->isFormPost()) { 31 $status->delete(); 32 $uri = new PhutilURI($this->getApplicationURI()); 33 $uri->setQueryParams( 34 array( 35 'deleted' => true, 36 )); 37 return id(new AphrontRedirectResponse()) 38 ->setURI($uri); 39 } 40 41 $dialog = new AphrontDialogView(); 42 $dialog->setUser($user); 43 $dialog->setTitle(pht('Really delete status?')); 44 $dialog->appendChild( 45 pht('Permanently delete this status? This action can not be undone.')); 46 $dialog->addSubmitButton(pht('Delete')); 47 $dialog->addCancelButton( 48 $this->getApplicationURI('event/')); 49 50 return id(new AphrontDialogResponse())->setDialog($dialog); 51 52 } 53 54 }
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 |