<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Layout; use Closure; use Illuminate\Contracts\Support\Renderable; use ModStart\Core\Input\Request; use ModStart\Form\Form; use ModStart\Grid\Grid; class Page implements Renderable { private $pageTitle = ' '; private $pageKeywords = ''; private $pageDescription = ''; private $rows = array(); protected $view; private $viewData = array(); public function __construct(\Closure $SO11l = null) { if ($SO11l instanceof Closure) { $SO11l($this); } } public function body($Afv_G) { return $this->row($Afv_G); } public function row($Afv_G) { if ($Afv_G instanceof Closure) { goto LilMP; eoObj: call_user_func($Afv_G, $tMM4T); goto Wkm6r; LilMP: $tMM4T = new Row(); goto eoObj; Wkm6r: $this->addRow($tMM4T); goto fxc13; fxc13: } else { $this->addRow(new Row($Afv_G)); } return $this; } public function append($Afv_G) { $this->rows[] = $Afv_G; return $this; } public function view($XlNhR = null) { goto gmvDu; Zh0HR: return $this; goto cGKXs; JwAAA: $this->view = $XlNhR; goto Zh0HR; gmvDu: if (null === $XlNhR) { return $this->view; } goto JwAAA; cGKXs: } public function putViewData($FQ7ZJ, $Gttsd = null) { if (is_array($FQ7ZJ)) { $this->viewData = array_merge($this->viewData, $FQ7ZJ); } else { $this->viewData[$FQ7ZJ] = $Gttsd; } return $this; } public function pageTitle($Cu2PT = null) { goto oyLkt; Zp6XK: $this->pageTitle = $Cu2PT; goto nnUPR; nnUPR: return $this; goto TZlOX; oyLkt: if (null === $Cu2PT) { return $this->pageTitle; } goto Zp6XK; TZlOX: } public function pageKeywords($fac1M = null) { goto Cn19_; YZwtN: $this->pageKeywords = $fac1M; goto zD5ll; Cn19_: if (null === $fac1M) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto YZwtN; zD5ll: return $this; goto cjBtf; cjBtf: } public function pageDescription($XLhUz = null) { goto NZe_C; NZe_C: if (null === $XLhUz) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto JX47y; o0yH4: return $this; goto NKodn; JX47y: $this->pageDescription = $XLhUz; goto o0yH4; NKodn: } private function addRow(Row $tMM4T) { $this->rows[] = $tMM4T; } public function build() { goto hvdW6; UYKKg: foreach ($this->rows as $tMM4T) { if ($tMM4T instanceof Buildable) { $tMM4T->build(); } else { echo $tMM4T; } } goto H5ZeY; hvdW6: ob_start(); goto UYKKg; PgsK5: return $q4YT4; goto hxGKP; iET97: ob_end_clean(); goto PgsK5; H5ZeY: $q4YT4 = ob_get_contents(); goto iET97; hxGKP: } public function handleGrid($TzF5r) { if (Request::isPost()) { return $TzF5r->request(); } return $this; } public function handleForm($aDbJm, $SO11l, array $CnWtd = null) { if (Request::isPost()) { return $aDbJm->formRequest($SO11l, $CnWtd); } return $this; } public function render() { $CnWtd = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($CnWtd, $this->viewData))->render(); } }