Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103668533
PhabricatorActionHeaderExample.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
Mon, Mar 3, 21:28
Size
8 KB
Mime Type
text/x-php
Expires
Wed, Mar 5, 21:28 (2 d)
Engine
blob
Format
Raw Data
Handle
24633139
Attached To
rPH Phabricator
PhabricatorActionHeaderExample.php
View Options
<?php
final
class
PhabricatorActionHeaderExample
extends
PhabricatorUIExample
{
public
function
getName
()
{
return
'Action Headers'
;
}
public
function
getDescription
()
{
return
'Various header layouts with and without icons'
;
}
public
function
renderExample
()
{
/* Colors */
$title1
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
pht
(
'Header Plain'
));
$header1
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Colorless'
);
$header2
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Light Grey'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREY
);
$header3
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Blue'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_BLUE
);
$header4
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Green'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREEN
);
$header5
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Red'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_RED
);
$header6
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Yellow'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_YELLOW
);
$layout1
=
id
(
new
AphrontMultiColumnView
())
->
addColumn
(
$header1
)
->
addColumn
(
$header2
)
->
addColumn
(
$header3
)
->
addColumn
(
$header4
)
->
addColumn
(
$header5
)
->
addColumn
(
$header6
)
->
setFluidLayout
(
true
)
->
setGutter
(
AphrontMultiColumnView
::
GUTTER_SMALL
);
$wrap1
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'ml'
),
$layout1
);
/* Policy Icons */
$title2
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
pht
(
'With Policy Icons'
));
$header1
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setHeaderIcon
(
'company-dark'
);
$header2
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREY
)
->
setHeaderIcon
(
'public-dark'
);
$header3
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_BLUE
)
->
setHeaderIcon
(
'restricted-white'
);
$header4
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREEN
)
->
setHeaderIcon
(
'company-white'
);
$header5
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_RED
)
->
setHeaderIcon
(
'public-white'
);
$header6
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_YELLOW
)
->
setHeaderIcon
(
'restriced-white'
);
$layout2
=
id
(
new
AphrontMultiColumnView
())
->
addColumn
(
$header1
)
->
addColumn
(
$header2
)
->
addColumn
(
$header3
)
->
addColumn
(
$header4
)
->
addColumn
(
$header5
)
->
addColumn
(
$header6
)
->
setFluidLayout
(
true
)
->
setGutter
(
AphrontMultiColumnView
::
GUTTER_SMALL
);
$wrap2
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'ml'
),
$layout2
);
/* Action Icons */
$title3
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
pht
(
'With Action Icons'
));
$action1
=
new
PhabricatorActionIconView
();
$action1
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action1
->
setSpriteIcon
(
'settings-grey'
);
$action1
->
setHref
(
'#'
);
$action2
=
new
PhabricatorActionIconView
();
$action2
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action2
->
setSpriteIcon
(
'heart-white'
);
$action2
->
setHref
(
'#'
);
$action3
=
new
PhabricatorActionIconView
();
$action3
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action3
->
setSpriteIcon
(
'tag-white'
);
$action3
->
setHref
(
'#'
);
$action4
=
new
PhabricatorActionIconView
();
$action4
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action4
->
setSpriteIcon
(
'new-white'
);
$action4
->
setHref
(
'#'
);
$action5
=
new
PhabricatorActionIconView
();
$action5
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action5
->
setSpriteIcon
(
'search-white'
);
$action5
->
setHref
(
'#'
);
$action6
=
new
PhabricatorActionIconView
();
$action6
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action6
->
setSpriteIcon
(
'move-white'
);
$action6
->
setHref
(
'#'
);
$header1
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
addAction
(
$action1
);
$header2
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREY
)
->
addAction
(
$action1
);
$header3
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_BLUE
)
->
addAction
(
$action2
);
$header4
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREEN
)
->
addAction
(
$action3
);
$header5
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_RED
)
->
addAction
(
$action4
)
->
addAction
(
$action5
);
$header6
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderHref
(
'http://phacility.com/'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_YELLOW
)
->
addAction
(
$action6
);
$layout3
=
id
(
new
AphrontMultiColumnView
())
->
addColumn
(
$header1
)
->
addColumn
(
$header2
)
->
addColumn
(
$header3
)
->
addColumn
(
$header4
)
->
addColumn
(
$header5
)
->
addColumn
(
$header6
)
->
setFluidLayout
(
true
)
->
setGutter
(
AphrontMultiColumnView
::
GUTTER_SMALL
);
$wrap3
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'ml'
),
$layout3
);
/* Action Icons */
$title4
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
pht
(
'With Tags'
));
$tag1
=
id
(
new
PhabricatorTagView
())
->
setType
(
PhabricatorTagView
::
TYPE_STATE
)
->
setBackgroundColor
(
PhabricatorTagView
::
COLOR_RED
)
->
setName
(
'Open'
);
$tag2
=
id
(
new
PhabricatorTagView
())
->
setType
(
PhabricatorTagView
::
TYPE_STATE
)
->
setBackgroundColor
(
PhabricatorTagView
::
COLOR_BLUE
)
->
setName
(
'Closed'
);
$action1
=
new
PhabricatorActionIconView
();
$action1
->
setSpriteSheet
(
PhabricatorActionIconView
::
SPRITE_ACTIONS
);
$action1
->
setSpriteIcon
(
'flag-grey'
);
$action1
->
setHref
(
'#'
);
$header1
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setTag
(
$tag2
);
$header2
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREY
)
->
addAction
(
$action1
)
->
setTag
(
$tag1
);
$header3
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_BLUE
)
->
setTag
(
$tag2
);
$header4
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Company'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_GREEN
)
->
setTag
(
$tag1
);
$header5
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Public'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_RED
)
->
setTag
(
$tag2
);
$header6
=
id
(
new
PhabricatorActionHeaderView
())
->
setHeaderTitle
(
'Restricted'
)
->
setHeaderColor
(
PhabricatorActionHeaderView
::
HEADER_YELLOW
)
->
setTag
(
$tag1
);
$layout3
=
id
(
new
AphrontMultiColumnView
())
->
addColumn
(
$header1
)
->
addColumn
(
$header2
)
->
addColumn
(
$header3
)
->
addColumn
(
$header4
)
->
addColumn
(
$header5
)
->
addColumn
(
$header6
)
->
setFluidLayout
(
true
)
->
setGutter
(
AphrontMultiColumnView
::
GUTTER_SMALL
);
$wrap4
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'ml'
),
$layout3
);
return
phutil_tag
(
'div'
,
array
(),
array
(
$title1
,
$wrap1
,
$title2
,
$wrap2
,
$title3
,
$wrap3
,
$title4
,
$wrap4
));
}
}
Event Timeline
Log In to Comment