<?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 $yeJzO = null) { if ($yeJzO instanceof Closure) { $yeJzO($this); } } public function body($LTC5O) { return $this->row($LTC5O); } public function row($LTC5O) { if ($LTC5O instanceof Closure) { goto tpNXg; zuRu7: call_user_func($LTC5O, $KWrRN); goto jgdNH; jgdNH: $this->addRow($KWrRN); goto e3NJg; tpNXg: $KWrRN = new Row(); goto zuRu7; e3NJg: } else { $this->addRow(new Row($LTC5O)); } return $this; } public function append($LTC5O) { $this->rows[] = $LTC5O; return $this; } public function view($d1G11 = null) { goto D4B7E; wXRjV: return $this; goto VEYZn; UD4qg: $this->view = $d1G11; goto wXRjV; D4B7E: if (null === $d1G11) { return $this->view; } goto UD4qg; VEYZn: } public function putViewData($Nrpav, $mdHu1 = null) { if (is_array($Nrpav)) { $this->viewData = array_merge($this->viewData, $Nrpav); } else { $this->viewData[$Nrpav] = $mdHu1; } return $this; } public function pageTitle($nh64r = null) { goto BiU59; xYoF9: return $this; goto WoDkV; z6bla: $this->pageTitle = $nh64r; goto xYoF9; BiU59: if (null === $nh64r) { return $this->pageTitle; } goto z6bla; WoDkV: } public function pageKeywords($PpmSD = null) { goto IJKPQ; IJKPQ: if (null === $PpmSD) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto jQp0V; jQp0V: $this->pageKeywords = $PpmSD; goto XWnaY; XWnaY: return $this; goto gNnu3; gNnu3: } public function pageDescription($Sodbk = null) { goto F0WOh; F0WOh: if (null === $Sodbk) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto OhPjx; OhPjx: $this->pageDescription = $Sodbk; goto SoaTU; SoaTU: return $this; goto CifXJ; CifXJ: } private function addRow(Row $KWrRN) { $this->rows[] = $KWrRN; } public function build() { goto mgSQd; awB_Z: ob_end_clean(); goto N3fKF; N3fKF: return $KNNx8; goto rI3NC; LT2_A: foreach ($this->rows as $KWrRN) { if ($KWrRN instanceof Buildable) { $KWrRN->build(); } else { echo $KWrRN; } } goto ShMAl; ShMAl: $KNNx8 = ob_get_contents(); goto awB_Z; mgSQd: ob_start(); goto LT2_A; rI3NC: } public function handleGrid($jfjOt) { if (Request::isPost()) { return $jfjOt->request(); } return $this; } public function handleForm($wDk8k, $yeJzO, array $Sj05q = null) { if (Request::isPost()) { return $wDk8k->formRequest($yeJzO, $Sj05q); } return $this; } public function render() { $Sj05q = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($Sj05q, $this->viewData))->render(); } }