Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68920613
PhortuneProductListController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 29, 12:03
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jul 1, 12:03 (2 d)
Engine
blob
Format
Raw Data
Handle
18647872
Attached To
rPH Phabricator
PhortuneProductListController.php
View Options
<?php
final
class
PhortuneProductListController
extends
PhabricatorController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$pager
=
new
AphrontCursorPagerView
();
$pager
->
readFromRequest
(
$request
);
$query
=
id
(
new
PhortuneProductQuery
())
->
setViewer
(
$user
);
$products
=
$query
->
executeWithCursorPager
(
$pager
);
$title
=
pht
(
'Product List'
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
'Products'
,
$this
->
getApplicationURI
(
'product/'
));
$crumbs
->
addAction
(
id
(
new
PHUIListItemView
())
->
setName
(
pht
(
'Create Product'
))
->
setHref
(
$this
->
getApplicationURI
(
'product/edit/'
))
->
setIcon
(
'fa-plus-square'
));
$product_list
=
id
(
new
PHUIObjectItemListView
())
->
setUser
(
$user
)
->
setNoDataString
(
pht
(
'No products.'
));
foreach
(
$products
as
$product
)
{
$view_uri
=
$this
->
getApplicationURI
(
'product/view/'
.
$product
->
getID
().
'/'
);
$price
=
$product
->
getPriceInCents
();
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
$product
->
getID
())
->
setHeader
(
$product
->
getProductName
())
->
setHref
(
$view_uri
)
->
addAttribute
(
PhortuneCurrency
::
newFromUSDCents
(
$price
)->
formatForDisplay
())
->
addAttribute
(
$product
->
getTypeName
());
$product_list
->
addItem
(
$item
);
}
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$product_list
,
$pager
,
),
array
(
'title'
=>
$title
,
));
}
}
Event Timeline
Log In to Comment