Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1081715
ReleephRequestIntentsView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ReleephRequestIntentsView.php
View Options
<?php
final
class
ReleephRequestIntentsView
extends
AphrontView
{
private
$releephRequest
;
private
$releephProject
;
public
function
setReleephRequest
(
ReleephRequest
$rq
)
{
$this
->
releephRequest
=
$rq
;
return
$this
;
}
public
function
setReleephProject
(
ReleephProject
$rp
)
{
$this
->
releephProject
=
$rp
;
return
$this
;
}
public
function
render
()
{
require_celerity_resource
(
'releeph-intents'
);
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'releeph-intents'
,
),
array
(
$this
->
renderIntentList
(
ReleephRequest
::
INTENT_WANT
),
$this
->
renderIntentList
(
ReleephRequest
::
INTENT_PASS
)
));
}
private
function
renderIntentList
(
$render_intent
)
{
if
(!
$this
->
releephProject
)
{
throw
new
Exception
(
"Must call setReleephProject() first!"
);
}
$project
=
$this
->
releephProject
;
$request
=
$this
->
releephRequest
;
$handles
=
$request
->
getHandles
();
$pusher_links
=
array
();
$user_links
=
array
();
$intents
=
$request
->
getUserIntents
();
foreach
(
$intents
as
$user_phid
=>
$user_intent
)
{
if
(
$user_intent
==
$render_intent
)
{
if
(
$project
->
isAuthoritativePHID
(
$user_phid
))
{
$pusher_links
[]
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'pusher'
),
$handles
[
$user_phid
]->
renderLink
());
}
else
{
$class
=
'bystander'
;
if
(
$request
->
getRequestUserPHID
()
==
$user_phid
)
{
$class
=
'requestor'
;
}
$user_links
[]
=
phutil_tag
(
'span'
,
array
(
'class'
=>
$class
,
),
$handles
[
$user_phid
]->
renderLink
());
}
}
}
// Don't render anything
if
(!
$pusher_links
&&
!
$user_links
)
{
return
null
;
}
$links
=
array_merge
(
$pusher_links
,
$user_links
);
if
(
$links
)
{
$markup
=
$links
;
}
else
{
$markup
=
array
(
' '
);
}
// Stick an arrow up front
$arrow_class
=
'arrow '
.
$render_intent
;
array_unshift
(
$markup
,
phutil_tag
(
'div'
,
array
(
'class'
=>
$arrow_class
,
),
''
));
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'intents'
,
),
$markup
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jun 29, 9:46 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
264904
Default Alt Text
ReleephRequestIntentsView.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment