[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/owners/controller/ -> PhabricatorOwnersDeleteController.php (source)

   1  <?php
   2  
   3  final class PhabricatorOwnersDeleteController
   4    extends PhabricatorOwnersController {
   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      $package = id(new PhabricatorOwnersPackage())->load($this->id);
  17      if (!$package) {
  18        return new Aphront404Response();
  19      }
  20  
  21      if ($request->isDialogFormPost()) {
  22        $package->attachActorPHID($user->getPHID());
  23        $package->delete();
  24        return id(new AphrontRedirectResponse())->setURI('/owners/');
  25      }
  26  
  27      $text = pht('Are you sure you want to delete the "%s" package? This '.
  28            'operation can not be undone.', $package->getName());
  29      $dialog = id(new AphrontDialogView())
  30        ->setUser($user)
  31        ->setTitle('Really delete this package?')
  32        ->appendChild(phutil_tag('p', array(), $text))
  33        ->addSubmitButton(pht('Delete'))
  34        ->addCancelButton('/owners/package/'.$package->getID().'/')
  35        ->setSubmitURI($request->getRequestURI());
  36  
  37      return id(new AphrontDialogResponse())->setDialog($dialog);
  38    }
  39  
  40  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1