Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100780833
FundBackerCart.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
Sun, Feb 2, 17:10
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 17:10 (2 d)
Engine
blob
Format
Raw Data
Handle
24029887
Attached To
rPH Phabricator
FundBackerCart.php
View Options
<?php
final
class
FundBackerCart
extends
PhortuneCartImplementation
{
private
$initiativePHID
;
private
$initiative
;
public
function
setInitiativePHID
(
$initiative_phid
)
{
$this
->
initiativePHID
=
$initiative_phid
;
return
$this
;
}
public
function
getInitiativePHID
()
{
return
$this
->
initiativePHID
;
}
public
function
setInitiative
(
FundInitiative
$initiative
)
{
$this
->
initiative
=
$initiative
;
return
$this
;
}
public
function
getInitiative
()
{
return
$this
->
initiative
;
}
public
function
getName
()
{
return
pht
(
'Fund Initiative'
);
}
public
function
willCreateCart
(
PhabricatorUser
$viewer
,
PhortuneCart
$cart
)
{
$initiative
=
$this
->
getInitiative
();
if
(!
$initiative
)
{
throw
new
Exception
(
pht
(
'Call setInitiative() before building a cart!'
));
}
$cart
->
setMetadataValue
(
'initiativePHID'
,
$initiative
->
getPHID
());
}
public
function
loadImplementationsForCarts
(
PhabricatorUser
$viewer
,
array
$carts
)
{
$phids
=
array
();
foreach
(
$carts
as
$cart
)
{
$phids
[]
=
$cart
->
getMetadataValue
(
'initiativePHID'
);
}
$initiatives
=
id
(
new
FundInitiativeQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$phids
)
->
execute
();
$initiatives
=
mpull
(
$initiatives
,
null
,
'getPHID'
);
$objects
=
array
();
foreach
(
$carts
as
$key
=>
$cart
)
{
$initiative_phid
=
$cart
->
getMetadataValue
(
'initiativePHID'
);
$object
=
id
(
new
FundBackerCart
())
->
setInitiativePHID
(
$initiative_phid
);
$initiative
=
idx
(
$initiatives
,
$initiative_phid
);
if
(
$initiative
)
{
$object
->
setInitiative
(
$initiative
);
}
$objects
[
$key
]
=
$object
;
}
return
$objects
;
}
public
function
getCancelURI
(
PhortuneCart
$cart
)
{
return
'/'
.
$this
->
getInitiative
()->
getMonogram
();
}
public
function
getDoneURI
(
PhortuneCart
$cart
)
{
return
'/'
.
$this
->
getInitiative
()->
getMonogram
();
}
}
Event Timeline
Log In to Comment