Guarantee terms in PhabricatorAuthPasswordEngine are strings
[phabricator/blender.git] / src / view / phui / PHUIActionPanelView.php
blob8ced0a642b5cb3852a80f49e98232c13beaff5a3
1 <?php
3 final class PHUIActionPanelView extends AphrontTagView {
5 private $href;
6 private $fontIcon;
7 private $image;
8 private $header;
9 private $subHeader;
10 private $bigText;
11 private $state;
12 private $status;
14 const COLOR_RED = 'phui-action-panel-red';
15 const COLOR_ORANGE = 'phui-action-panel-orange';
16 const COLOR_YELLOW = 'phui-action-panel-yellow';
17 const COLOR_GREEN = 'phui-action-panel-green';
18 const COLOR_BLUE = 'phui-action-panel-blue';
19 const COLOR_INDIGO = 'phui-action-panel-indigo';
20 const COLOR_VIOLET = 'phui-action-panel-violet';
21 const COLOR_PINK = 'phui-action-panel-pink';
23 public function setHref($href) {
24 $this->href = $href;
25 return $this;
28 public function setIcon($image) {
29 $this->fontIcon = $image;
30 return $this;
33 public function setImage($image) {
34 $this->image = $image;
35 return $this;
38 public function setBigText($text) {
39 $this->bigText = $text;
40 return $this;
43 public function setHeader($header) {
44 $this->header = $header;
45 return $this;
48 public function setSubHeader($sub) {
49 $this->subHeader = $sub;
50 return $this;
53 public function setState($state) {
54 $this->state = $state;
55 return $this;
58 public function setStatus($text) {
59 $this->status = $text;
60 return $this;
63 protected function getTagName() {
64 return 'div';
67 protected function getTagAttributes() {
68 require_celerity_resource('phui-action-panel-css');
70 $classes = array();
71 $classes[] = 'phui-action-panel';
72 if ($this->state) {
73 $classes[] = $this->state;
75 if ($this->bigText) {
76 $classes[] = 'phui-action-panel-bigtext';
79 return array(
80 'class' => implode(' ', $classes),
84 protected function getTagContent() {
86 $icon = null;
87 if ($this->fontIcon) {
88 $fonticon = id(new PHUIIconView())
89 ->setIcon($this->fontIcon);
90 $icon = phutil_tag(
91 'span',
92 array(
93 'class' => 'phui-action-panel-icon',
95 $fonticon);
98 if ($this->image) {
99 $image = phutil_tag(
100 'img',
101 array(
102 'class' => 'phui-action-panel-image',
103 'src' => $this->image,
105 $icon = phutil_tag(
106 'span',
107 array(
108 'class' => 'phui-action-panel-icon',
110 $image);
113 $header = null;
114 if ($this->header) {
115 $header = phutil_tag(
116 'span',
117 array(
118 'class' => 'phui-action-panel-header',
120 $this->header);
123 $subheader = null;
124 if ($this->subHeader) {
125 $subheader = phutil_tag(
126 'span',
127 array(
128 'class' => 'phui-action-panel-subheader',
130 $this->subHeader);
133 $row = phutil_tag(
134 'span',
135 array(
136 'class' => 'phui-action-panel-row',
138 array(
139 $icon,
140 $subheader,
143 $table = phutil_tag(
144 'span',
145 array(
146 'class' => 'phui-action-panel-table',
148 $row);
150 return phutil_tag(
151 'a',
152 array(
153 'href' => $this->href,
154 'class' => 'phui-action-panel-hitarea',
156 array($header, $table));