<?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 $uTSeU = null) { if ($uTSeU instanceof Closure) { $uTSeU($this); } } public function body($BWI89) { return $this->row($BWI89); } public function row($BWI89) { if ($BWI89 instanceof Closure) { goto SkkXo; FDg1S: call_user_func($BWI89, $EzOZh); goto sVHZ_; sVHZ_: $this->addRow($EzOZh); goto afXWY; SkkXo: $EzOZh = new Row(); goto FDg1S; afXWY: } else { $this->addRow(new Row($BWI89)); } return $this; } public function append($BWI89) { $this->rows[] = $BWI89; return $this; } public function view($x0USf = null) { goto MecBF; MecBF: if (null === $x0USf) { return $this->view; } goto SsQwp; SsQwp: $this->view = $x0USf; goto WlMLD; WlMLD: return $this; goto uNhme; uNhme: } public function putViewData($eP0gx, $HDpl6 = null) { if (is_array($eP0gx)) { $this->viewData = array_merge($this->viewData, $eP0gx); } else { $this->viewData[$eP0gx] = $HDpl6; } return $this; } public function pageTitle($ZZCu3 = null) { goto QV78o; QV78o: if (null === $ZZCu3) { return $this->pageTitle; } goto kroGu; xG2L3: return $this; goto b43ln; kroGu: $this->pageTitle = $ZZCu3; goto xG2L3; b43ln: } public function pageKeywords($JYE1w = null) { goto OX_po; OX_po: if (null === $JYE1w) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto jKns2; WGvMd: return $this; goto Otwo8; jKns2: $this->pageKeywords = $JYE1w; goto WGvMd; Otwo8: } public function pageDescription($E1k2b = null) { goto U77N2; U77N2: if (null === $E1k2b) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto xBv1A; FyoT5: return $this; goto vhmuW; xBv1A: $this->pageDescription = $E1k2b; goto FyoT5; vhmuW: } private function addRow(Row $EzOZh) { $this->rows[] = $EzOZh; } public function build() { goto yCSdk; yCSdk: ob_start(); goto WfZE7; x2DqI: $ZLTa0 = ob_get_contents(); goto CUM21; AuejA: return $ZLTa0; goto QIlOB; CUM21: ob_end_clean(); goto AuejA; WfZE7: foreach ($this->rows as $EzOZh) { if ($EzOZh instanceof Buildable) { $EzOZh->build(); } else { echo $EzOZh; } } goto x2DqI; QIlOB: } public function handleGrid($cRz_h) { if (Request::isPost()) { return $cRz_h->request(); } return $this; } public function handleForm($yfPYJ, $uTSeU, array $zonFp = null) { if (Request::isPost()) { return $yfPYJ->formRequest($uTSeU, $zonFp); } return $this; } public function render() { $zonFp = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($zonFp, $this->viewData))->render(); } }