Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phortune / controller / product / PhortuneProductViewController.php
bloba434a9453488df80c11a3f6fb11eaa10791776b6
1 <?php
3 final class PhortuneProductViewController extends PhortuneController {
5 public function handleRequest(AphrontRequest $request) {
6 $viewer = $request->getViewer();
7 $id = $request->getURIData('id');
9 $product = id(new PhortuneProductQuery())
10 ->setViewer($viewer)
11 ->withIDs(array($id))
12 ->executeOne();
13 if (!$product) {
14 return new Aphront404Response();
17 $title = pht('Product: %s', $product->getProductName());
19 $header = id(new PHUIHeaderView())
20 ->setHeader($product->getProductName())
21 ->setHeaderIcon('fa-gift');
23 $edit_uri = $this->getApplicationURI('product/edit/'.$product->getID().'/');
25 $crumbs = $this->buildApplicationCrumbs();
26 $crumbs->addTextCrumb(
27 pht('Products'),
28 $this->getApplicationURI('product/'));
29 $crumbs->addTextCrumb(
30 pht('#%d', $product->getID()),
31 $request->getRequestURI());
32 $crumbs->setBorder(true);
34 $properties = id(new PHUIPropertyListView())
35 ->setUser($viewer)
36 ->addProperty(
37 pht('Price'),
38 $product->getPriceAsCurrency()->formatForDisplay());
40 $object_box = id(new PHUIObjectBoxView())
41 ->setHeaderText(pht('Details'))
42 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
43 ->addPropertyList($properties);
45 $view = id(new PHUITwoColumnView())
46 ->setHeader($header)
47 ->setFooter(array(
48 $object_box,
49 ));
51 return $this->newPage()
52 ->setTitle($title)
53 ->setCrumbs($crumbs)
54 ->appendChild($view);