<?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 $aCnQE = null) { if ($aCnQE instanceof Closure) { $aCnQE($this); } } public function body($cgjRu) { return $this->row($cgjRu); } public function row($cgjRu) { if ($cgjRu instanceof Closure) { goto hIYcF; bV5C0: $this->addRow($Bhp8r); goto pk59A; hIYcF: $Bhp8r = new Row(); goto K00HD; K00HD: call_user_func($cgjRu, $Bhp8r); goto bV5C0; pk59A: } else { $this->addRow(new Row($cgjRu)); } return $this; } public function append($cgjRu) { $this->rows[] = $cgjRu; return $this; } public function view($Etyzz = null) { goto PR5Ea; GPULF: return $this; goto krPjE; PR5Ea: if (null === $Etyzz) { return $this->view; } goto FIbYO; FIbYO: $this->view = $Etyzz; goto GPULF; krPjE: } public function putViewData($Z83yJ, $wvO30 = null) { if (is_array($Z83yJ)) { $this->viewData = array_merge($this->viewData, $Z83yJ); } else { $this->viewData[$Z83yJ] = $wvO30; } return $this; } public function pageTitle($K2Qcf = null) { goto MU8El; O41wx: $this->pageTitle = $K2Qcf; goto Qo3dR; Qo3dR: return $this; goto UvWn5; MU8El: if (null === $K2Qcf) { return $this->pageTitle; } goto O41wx; UvWn5: } public function pageKeywords($jS1gp = null) { goto k5yMu; k5yMu: if (null === $jS1gp) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto ATl89; ATl89: $this->pageKeywords = $jS1gp; goto slJDo; slJDo: return $this; goto pDcFl; pDcFl: } public function pageDescription($WrExI = null) { goto btDeX; l8IYc: return $this; goto Yu3m7; qA_EL: $this->pageDescription = $WrExI; goto l8IYc; btDeX: if (null === $WrExI) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto qA_EL; Yu3m7: } private function addRow(Row $Bhp8r) { $this->rows[] = $Bhp8r; } public function build() { goto ocTqC; YJ1Ws: $R428K = ob_get_contents(); goto OET11; yhoWy: foreach ($this->rows as $Bhp8r) { if ($Bhp8r instanceof Buildable) { $Bhp8r->build(); } else { echo $Bhp8r; } } goto YJ1Ws; g87V9: return $R428K; goto I9N6g; ocTqC: ob_start(); goto yhoWy; OET11: ob_end_clean(); goto g87V9; I9N6g: } public function handleGrid($xtA75) { if (Request::isPost()) { return $xtA75->request(); } return $this; } public function handleForm($LEyIF, $aCnQE, array $SjN8A = null) { if (Request::isPost()) { return $LEyIF->formRequest($aCnQE, $SjN8A); } return $this; } public function render() { $SjN8A = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($SjN8A, $this->viewData))->render(); } }