[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phortune/controller/ -> PhortuneProductViewController.php (source)

   1  <?php
   2  
   3  final class PhortuneProductViewController extends PhortuneController {
   4  
   5    private $productID;
   6  
   7    public function willProcessRequest(array $data) {
   8      $this->productID = $data['id'];
   9    }
  10  
  11    public function processRequest() {
  12      $request = $this->getRequest();
  13      $user = $request->getUser();
  14  
  15      $product = id(new PhortuneProductQuery())
  16        ->setViewer($user)
  17        ->withIDs(array($this->productID))
  18        ->executeOne();
  19      if (!$product) {
  20        return new Aphront404Response();
  21      }
  22  
  23      $title = pht('Product: %s', $product->getProductName());
  24  
  25      $header = id(new PHUIHeaderView())
  26        ->setHeader($product->getProductName());
  27  
  28      $edit_uri = $this->getApplicationURI('product/edit/'.$product->getID().'/');
  29  
  30      $actions = id(new PhabricatorActionListView())
  31        ->setUser($user)
  32        ->setObjectURI($request->getRequestURI());
  33  
  34      $crumbs = $this->buildApplicationCrumbs();
  35      $crumbs->setActionList($actions);
  36      $crumbs->addTextCrumb(
  37        pht('Products'),
  38        $this->getApplicationURI('product/'));
  39      $crumbs->addTextCrumb(
  40        pht('#%d', $product->getID()),
  41        $request->getRequestURI());
  42  
  43      $properties = id(new PHUIPropertyListView())
  44        ->setUser($user)
  45        ->setActionList($actions)
  46        ->addProperty(
  47          pht('Price'),
  48          $product->getPriceAsCurrency()->formatForDisplay());
  49  
  50      $object_box = id(new PHUIObjectBoxView())
  51        ->setHeader($header)
  52        ->addPropertyList($properties);
  53  
  54      return $this->buildApplicationPage(
  55        array(
  56          $crumbs,
  57          $object_box,
  58        ),
  59        array(
  60          'title' => $title,
  61        ));
  62    }
  63  
  64  }


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