Path: blob/master/src/view/formation/PHUIFormationFlankView.php
12249 views
<?php12final class PHUIFormationFlankView3extends PHUIFormationColumnDynamicView {45private $isFixed;67private $head;8private $body;9private $tail;1011private $headID;12private $bodyID;13private $tailID;1415private $headerText;1617public function setIsFixed($fixed) {18$this->isFixed = $fixed;19return $this;20}2122public function getIsFixed() {23return $this->isFixed;24}2526public function setHead($head) {27$this->head = $head;28return $this;29}3031public function setBody($body) {32$this->body = $body;33return $this;34}3536public function setTail($tail) {37$this->tail = $tail;38return $this;39}4041public function getHeadID() {42if (!$this->headID) {43$this->headID = celerity_generate_unique_node_id();44}45return $this->headID;46}4748public function getBodyID() {49if (!$this->bodyID) {50$this->bodyID = celerity_generate_unique_node_id();51}52return $this->bodyID;53}5455public function getTailID() {56if (!$this->tailID) {57$this->tailID = celerity_generate_unique_node_id();58}59return $this->tailID;60}6162public function setHeaderText($header_text) {63$this->headerText = $header_text;64return $this;65}6667public function getHeaderText() {68return $this->headerText;69}7071public function newClientProperties() {72return array(73'type' => 'flank',74'nodeID' => $this->getID(),75'isFixed' => (bool)$this->getIsFixed(),76'headID' => $this->getHeadID(),77'bodyID' => $this->getBodyID(),78'tailID' => $this->getTailID(),79);80}8182public function render() {83require_celerity_resource('phui-formation-view-css');8485$width = $this->getWidth();8687$style = array();88$style[] = sprintf('width: %dpx;', $width);8990$classes = array();91$classes[] = 'phui-flank-view';9293if ($this->getIsFixed()) {94$classes[] = 'phui-flank-view-fixed';95}9697$head_id = $this->getHeadID();98$body_id = $this->getBodyID();99$tail_id = $this->getTailID();100101$header = phutil_tag(102'div',103array(104'class' => 'phui-flank-header',105),106array(107phutil_tag(108'div',109array(110'class' => 'phui-flank-header-text',111),112$this->getHeaderText()),113$this->newHideButton(),114));115116$content = phutil_tag(117'div',118array(119'id' => $this->getID(),120'class' => implode(' ', $classes),121'style' => implode(' ', $style),122),123array(124phutil_tag(125'div',126array(127'id' => $head_id,128'class' => 'phui-flank-view-head',129),130array(131$header,132$this->head,133)),134phutil_tag(135'div',136array(137'id' => $body_id,138'class' => 'phui-flank-view-body',139),140$this->body),141phutil_tag(142'div',143array(144'id' => $tail_id,145'class' => 'phui-flank-view-tail',146),147$this->tail),148));149150return $content;151}152153private function newHideButton() {154$item = $this->getColumnItem();155$is_right = $item->getIsRightAligned();156157$hide_classes = array();158$hide_classes[] = 'phui-flank-header-hide';159160if ($is_right) {161$hide_icon = id(new PHUIIconView())162->setIcon('fa-chevron-right grey');163$hide_classes[] = 'phui-flank-header-hide-right';164} else {165$hide_icon = id(new PHUIIconView())166->setIcon('fa-chevron-left grey');167$hide_classes[] = 'phui-flank-header-hide-left';168}169170return javelin_tag(171'div',172array(173'sigil' => 'phui-flank-header-hide',174'class' => implode(' ', $hide_classes),175),176$hide_icon);177}178179}180181182