<?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 $b9NqF = null) { if ($b9NqF instanceof Closure) { $b9NqF($this); } } public function body($vVYCS) { return $this->row($vVYCS); } public function row($vVYCS) { if ($vVYCS instanceof Closure) { goto Mwfqw; Mwfqw: $hcOFW = new Row(); goto u1T9O; u1T9O: call_user_func($vVYCS, $hcOFW); goto k3SEX; k3SEX: $this->addRow($hcOFW); goto AIfri; AIfri: } else { $this->addRow(new Row($vVYCS)); } return $this; } public function append($vVYCS) { $this->rows[] = $vVYCS; return $this; } public function view($FOcXW = null) { goto Aq0HU; jmj03: $this->view = $FOcXW; goto PGMcJ; Aq0HU: if (null === $FOcXW) { return $this->view; } goto jmj03; PGMcJ: return $this; goto kROFA; kROFA: } public function putViewData($vmXPY, $Mczr_ = null) { if (is_array($vmXPY)) { $this->viewData = array_merge($this->viewData, $vmXPY); } else { $this->viewData[$vmXPY] = $Mczr_; } return $this; } public function pageTitle($bCcG9 = null) { goto mc5jS; mc5jS: if (null === $bCcG9) { return $this->pageTitle; } goto YiQSO; d64Sb: return $this; goto z3b9J; YiQSO: $this->pageTitle = $bCcG9; goto d64Sb; z3b9J: } public function pageKeywords($sxzDo = null) { goto E9L4l; E9L4l: if (null === $sxzDo) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto u1gOS; Emjqb: return $this; goto HA_Du; u1gOS: $this->pageKeywords = $sxzDo; goto Emjqb; HA_Du: } public function pageDescription($RGUwu = null) { goto XHMO4; z8g5Z: return $this; goto kITGJ; XHMO4: if (null === $RGUwu) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto SaS1x; SaS1x: $this->pageDescription = $RGUwu; goto z8g5Z; kITGJ: } private function addRow(Row $hcOFW) { $this->rows[] = $hcOFW; } public function build() { goto KLHee; AsS3y: ob_end_clean(); goto fzOEs; Kr7Gx: foreach ($this->rows as $hcOFW) { if ($hcOFW instanceof Buildable) { $hcOFW->build(); } else { echo $hcOFW; } } goto Jm175; fzOEs: return $zg3kc; goto CgdwH; KLHee: ob_start(); goto Kr7Gx; Jm175: $zg3kc = ob_get_contents(); goto AsS3y; CgdwH: } public function handleGrid($FGotH) { if (Request::isPost()) { return $FGotH->request(); } return $this; } public function handleForm($SKFwZ, $b9NqF, array $zvN10 = null) { if (Request::isPost()) { return $SKFwZ->formRequest($b9NqF, $zvN10); } return $this; } public function render() { $zvN10 = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($zvN10, $this->viewData))->render(); } }