Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100800417
PHUISegmentBarView.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, 21:20
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 21:20 (2 d)
Engine
blob
Format
Raw Data
Handle
24036796
Attached To
rPH Phabricator
PHUISegmentBarView.php
View Options
<?php
final
class
PHUISegmentBarView
extends
AphrontTagView
{
private
$label
;
private
$segments
=
array
();
public
function
setLabel
(
$label
)
{
$this
->
label
=
$label
;
return
$this
;
}
public
function
newSegment
()
{
$segment
=
new
PHUISegmentBarSegmentView
();
$this
->
segments
[]
=
$segment
;
return
$segment
;
}
protected
function
canAppendChild
()
{
return
false
;
}
protected
function
getTagAttributes
()
{
return
array
(
'class'
=>
'phui-segment-bar-view'
,
);
}
protected
function
getTagContent
()
{
require_celerity_resource
(
'phui-segment-bar-view-css'
);
$label
=
$this
->
label
;
if
(
strlen
(
$label
))
{
$label
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-segment-bar-label'
,
),
$label
);
}
$segments
=
$this
->
segments
;
$position
=
0
;
foreach
(
$segments
as
$segment
)
{
$segment
->
setPosition
(
$position
);
$position
+=
$segment
->
getWidth
();
}
$segments
=
array_reverse
(
$segments
);
$segments
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-segment-bar-segments'
,
),
$segments
);
return
array
(
$label
,
$segments
,
);
}
}
Event Timeline
Log In to Comment