Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97941737
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
Tue, Jan 7, 19:52
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 19:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23446652
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