<?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 $Yzz3F = null) { if ($Yzz3F instanceof Closure) { $Yzz3F($this); } } public function body($ohNZt) { return $this->row($ohNZt); } public function row($ohNZt) { if ($ohNZt instanceof Closure) { goto FqZfG; KJ48f: call_user_func($ohNZt, $V0u2z); goto qOQec; qOQec: $this->addRow($V0u2z); goto mTGlA; FqZfG: $V0u2z = new Row(); goto KJ48f; mTGlA: } else { $this->addRow(new Row($ohNZt)); } return $this; } public function append($ohNZt) { $this->rows[] = $ohNZt; return $this; } public function view($WDpfu = null) { goto Iewu0; Iewu0: if (null === $WDpfu) { return $this->view; } goto edWBh; OKQSD: return $this; goto zHOJU; edWBh: $this->view = $WDpfu; goto OKQSD; zHOJU: } public function putViewData($VajzC, $ib3B9 = null) { if (is_array($VajzC)) { $this->viewData = array_merge($this->viewData, $VajzC); } else { $this->viewData[$VajzC] = $ib3B9; } return $this; } public function pageTitle($NRFW1 = null) { goto Zl3x6; ayRca: $this->pageTitle = $NRFW1; goto BHsQ2; BHsQ2: return $this; goto KOVuJ; Zl3x6: if (null === $NRFW1) { return $this->pageTitle; } goto ayRca; KOVuJ: } public function pageKeywords($v5lkA = null) { goto ETScq; gCmvE: $this->pageKeywords = $v5lkA; goto JMGKk; JMGKk: return $this; goto SbifE; ETScq: if (null === $v5lkA) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto gCmvE; SbifE: } public function pageDescription($scUF7 = null) { goto n3atK; pWynZ: return $this; goto qBO_B; sfy12: $this->pageDescription = $scUF7; goto pWynZ; n3atK: if (null === $scUF7) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto sfy12; qBO_B: } private function addRow(Row $V0u2z) { $this->rows[] = $V0u2z; } public function build() { goto agM8t; kzhLL: return $NMwSd; goto qtP6j; uYPf4: $NMwSd = ob_get_contents(); goto Py_oS; Py_oS: ob_end_clean(); goto kzhLL; UurN2: foreach ($this->rows as $V0u2z) { if ($V0u2z instanceof Buildable) { $V0u2z->build(); } else { echo $V0u2z; } } goto uYPf4; agM8t: ob_start(); goto UurN2; qtP6j: } public function handleGrid($BtYIX) { if (Request::isPost()) { return $BtYIX->request(); } return $this; } public function handleForm($mjvnb, $Yzz3F, array $IaeCl = null) { if (Request::isPost()) { return $mjvnb->formRequest($Yzz3F, $IaeCl); } return $this; } public function render() { $IaeCl = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($IaeCl, $this->viewData))->render(); } }