[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhameBlogDeleteController extends PhameController { 4 5 private $id; 6 7 public function willProcessRequest(array $data) { 8 $this->id = $data['id']; 9 } 10 11 public function processRequest() { 12 $request = $this->getRequest(); 13 $user = $request->getUser(); 14 15 $blog = id(new PhameBlogQuery()) 16 ->setViewer($user) 17 ->withIDs(array($this->id)) 18 ->requireCapabilities( 19 array( 20 PhabricatorPolicyCapability::CAN_EDIT, 21 )) 22 ->executeOne(); 23 if (!$blog) { 24 return new Aphront404Response(); 25 } 26 27 if ($request->isFormPost()) { 28 $blog->delete(); 29 return id(new AphrontRedirectResponse()) 30 ->setURI($this->getApplicationURI()); 31 } 32 33 $cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/'); 34 35 $dialog = id(new AphrontDialogView()) 36 ->setUser($user) 37 ->setTitle(pht('Delete Blog?')) 38 ->appendChild( 39 pht( 40 'Really delete the blog "%s"? It will be gone forever.', 41 $blog->getName())) 42 ->addSubmitButton(pht('Delete')) 43 ->addCancelButton($cancel_uri); 44 45 return id(new AphrontDialogResponse())->setDialog($dialog); 46 } 47 48 }
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 |