Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97894875
HeraldRuleListView.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
Tue, Jan 7, 07:31
Size
2 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 07:31 (2 d)
Engine
blob
Format
Raw Data
Handle
23433522
Attached To
rPH Phabricator
HeraldRuleListView.php
View Options
<?php
final
class
HeraldRuleListView
extends
AphrontView
{
private
$rules
;
private
$handles
;
private
$showAuthor
;
private
$showRuleType
;
public
function
setRules
(
array
$rules
)
{
assert_instances_of
(
$rules
,
'HeraldRule'
);
$this
->
rules
=
$rules
;
return
$this
;
}
public
function
setHandles
(
array
$handles
)
{
assert_instances_of
(
$handles
,
'PhabricatorObjectHandle'
);
$this
->
handles
=
$handles
;
return
$this
;
}
public
function
setShowAuthor
(
$show_author
)
{
$this
->
showAuthor
=
$show_author
;
return
$this
;
}
public
function
setShowRuleType
(
$show_rule_type
)
{
$this
->
showRuleType
=
$show_rule_type
;
return
$this
;
}
public
function
render
()
{
$type_map
=
HeraldRuleTypeConfig
::
getRuleTypeMap
();
$list
=
new
PhabricatorObjectItemListView
();
$list
->
setFlush
(
true
);
$list
->
setCards
(
true
);
foreach
(
$this
->
rules
as
$rule
)
{
if
(
$rule
->
getRuleType
()
==
HeraldRuleTypeConfig
::
RULE_TYPE_GLOBAL
)
{
$author
=
pht
(
'Global Rule'
);
}
else
{
$author
=
$this
->
handles
[
$rule
->
getAuthorPHID
()]->
renderLink
();
$author
=
pht
(
'Editor: %s'
,
$author
);
}
$edit_log
=
phutil_tag
(
'a'
,
array
(
'href'
=>
'/herald/history/'
.
$rule
->
getID
().
'/'
,
),
pht
(
'View Edit Log'
));
$delete
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'/herald/delete/'
.
$rule
->
getID
().
'/'
,
'sigil'
=>
'workflow'
,
),
pht
(
'Delete'
));
$item
=
id
(
new
PhabricatorObjectItemView
())
->
setObjectName
(
$type_map
[
$rule
->
getRuleType
()])
->
setHeader
(
$rule
->
getName
())
->
setHref
(
'/herald/rule/'
.
$rule
->
getID
().
'/'
)
->
addAttribute
(
$edit_log
)
->
addIcon
(
'none'
,
$author
)
->
addAction
(
id
(
new
PHUIListItemView
())
->
setHref
(
'/herald/delete/'
.
$rule
->
getID
().
'/'
)
->
setIcon
(
'delete'
)
->
setWorkflow
(
true
));
$list
->
addItem
(
$item
);
}
$list
->
setNoDataString
(
pht
(
"No matching rules."
));
return
$list
;
}
}
Event Timeline
Log In to Comment