Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890235
PhabricatorAphrontBarUIExample.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorAphrontBarUIExample.php
View Options
<?php
final
class
PhabricatorAphrontBarUIExample
extends
PhabricatorUIExample
{
public
function
getName
(
)
{
return
pht
(
'Bars'
)
;
}
public
function
getDescription
(
)
{
return
pht
(
'Like fractions, but more horizontal.'
)
;
}
public
function
renderExample
(
)
{
$out
=
array
(
)
;
$out
[
]
=
$this
->
renderRainbow
(
)
;
return
$out
;
}
private
function
wrap
(
$title
,
$thing
)
{
$thing
=
phutil_tag_div
(
'ml grouped'
,
$thing
)
;
return
id
(
new
PHUIObjectBoxView
(
)
)
->
setHeaderText
(
$title
)
->
appendChild
(
$thing
)
;
}
private
function
renderRainbow
(
)
{
$colors
=
array
(
'red'
,
'orange'
,
'yellow'
,
'green'
,
'blue'
,
'indigo'
,
'violet'
,
)
;
$labels
=
array
(
pht
(
'Empty'
)
,
pht
(
'Red'
)
,
pht
(
'Orange'
)
,
pht
(
'Yellow'
)
,
pht
(
'Green'
)
,
pht
(
'Blue'
)
,
pht
(
'Indigo'
)
,
pht
(
'Violet'
)
,
)
;
$bars
=
array
(
)
;
for
(
$jj
=
-
1
;
$jj
<
count
(
$colors
)
;
$jj
++
)
{
$bar
=
id
(
new
PHUISegmentBarView
(
)
)
->
setLabel
(
$labels
[
$jj
+
1
]
)
;
for
(
$ii
=
0
;
$ii
<=
$jj
;
$ii
++
)
{
$bar
->
newSegment
(
)
->
setWidth
(
1
/
7
)
->
setColor
(
$colors
[
$ii
]
)
;
}
$bars
[
]
=
$bar
;
}
$bars
=
phutil_implode_html
(
phutil_tag
(
'br'
)
,
$bars
)
;
return
$this
->
wrap
(
pht
(
'Rainbow Bars'
)
,
$bars
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 13:14 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124969
Default Alt Text
PhabricatorAphrontBarUIExample.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment