Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIDocumentView.php
<?php | <?php | ||||
final class PHUIDocumentView extends AphrontTagView { | final class PHUIDocumentView extends AphrontTagView { | ||||
private $header; | private $header; | ||||
private $bookname; | private $bookname; | ||||
private $bookdescription; | private $bookdescription; | ||||
private $fluid; | private $fluid; | ||||
private $toc; | private $toc; | ||||
private $foot; | private $foot; | ||||
private $curtain; | |||||
public function setHeader(PHUIHeaderView $header) { | public function setHeader(PHUIHeaderView $header) { | ||||
$header->setTall(true); | $header->setTall(true); | ||||
$this->header = $header; | $this->header = $header; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setBook($name, $description) { | public function setBook($name, $description) { | ||||
Show All 12 Lines | public function setToc($toc) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setFoot($foot) { | public function setFoot($foot) { | ||||
$this->foot = $foot; | $this->foot = $foot; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setCurtain(PHUICurtainView $curtain) { | |||||
$this->curtain = $curtain; | |||||
return $this; | |||||
} | |||||
public function getCurtain() { | |||||
return $this->curtain; | |||||
} | |||||
protected function getTagAttributes() { | protected function getTagAttributes() { | ||||
$classes = array(); | $classes = array(); | ||||
$classes[] = 'phui-document-container'; | $classes[] = 'phui-document-container'; | ||||
if ($this->fluid) { | if ($this->fluid) { | ||||
$classes[] = 'phui-document-fluid'; | $classes[] = 'phui-document-fluid'; | ||||
} | } | ||||
if ($this->foot) { | if ($this->foot) { | ||||
Show All 9 Lines | protected function getTagContent() { | ||||
require_celerity_resource('phui-document-view-css'); | require_celerity_resource('phui-document-view-css'); | ||||
require_celerity_resource('phui-document-view-pro-css'); | require_celerity_resource('phui-document-view-pro-css'); | ||||
Javelin::initBehavior('phabricator-reveal-content'); | Javelin::initBehavior('phabricator-reveal-content'); | ||||
$classes = array(); | $classes = array(); | ||||
$classes[] = 'phui-document-view'; | $classes[] = 'phui-document-view'; | ||||
$classes[] = 'phui-document-view-pro'; | $classes[] = 'phui-document-view-pro'; | ||||
if ($this->curtain) { | |||||
$classes[] = 'has-curtain'; | |||||
} else { | |||||
$classes[] = 'has-no-curtain'; | |||||
} | |||||
if ($this->curtain) { | |||||
$action_list = $this->curtain->getActionList(); | |||||
$this->header->setActionListID($action_list->getID()); | |||||
} | |||||
$book = null; | $book = null; | ||||
if ($this->bookname) { | if ($this->bookname) { | ||||
$book = pht('%s (%s)', $this->bookname, $this->bookdescription); | $book = pht('%s (%s)', $this->bookname, $this->bookdescription); | ||||
} | } | ||||
$main_content = $this->renderChildren(); | $main_content = $this->renderChildren(); | ||||
if ($book) { | if ($book) { | ||||
Show All 37 Lines | if ($this->foot) { | ||||
$foot_content = phutil_tag( | $foot_content = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-document-foot-content', | 'class' => 'phui-document-foot-content', | ||||
), | ), | ||||
$this->foot); | $this->foot); | ||||
} | } | ||||
$curtain = null; | |||||
if ($this->curtain) { | |||||
$curtain = phutil_tag( | |||||
'div', | |||||
array( | |||||
'class' => 'phui-document-curtain', | |||||
), | |||||
$this->curtain); | |||||
} | |||||
$main_content = phutil_tag( | |||||
'div', | |||||
array( | |||||
'class' => 'phui-document-content-view', | |||||
), | |||||
$main_content); | |||||
$content_inner = phutil_tag( | $content_inner = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-document-inner', | 'class' => 'phui-document-inner', | ||||
), | ), | ||||
array( | array( | ||||
$table_of_contents, | $table_of_contents, | ||||
$this->header, | $this->header, | ||||
array( | |||||
$curtain, | |||||
$main_content, | $main_content, | ||||
), | |||||
$foot_content, | $foot_content, | ||||
)); | )); | ||||
$content = phutil_tag( | $content = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-document-content', | 'class' => 'phui-document-content', | ||||
), | ), | ||||
$content_inner); | $content_inner); | ||||
return phutil_tag( | return phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
), | ), | ||||
$content); | $content); | ||||
} | } | ||||
} | } |