<?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 $liNDm = null) { if ($liNDm instanceof Closure) { $liNDm($this); } } public function body($gP2DQ) { return $this->row($gP2DQ); } public function row($gP2DQ) { if ($gP2DQ instanceof Closure) { goto ZAEA1; RwNle: call_user_func($gP2DQ, $tEaF3); goto nkBQP; ZAEA1: $tEaF3 = new Row(); goto RwNle; nkBQP: $this->addRow($tEaF3); goto OpTpU; OpTpU: } else { $this->addRow(new Row($gP2DQ)); } return $this; } public function append($gP2DQ) { $this->rows[] = $gP2DQ; return $this; } public function view($Y65Gr = null) { goto Vpvk3; SIMVL: $this->view = $Y65Gr; goto kEjJt; Vpvk3: if (null === $Y65Gr) { return $this->view; } goto SIMVL; kEjJt: return $this; goto iBivr; iBivr: } public function putViewData($C6UW8, $cBDsM = null) { if (is_array($C6UW8)) { $this->viewData = array_merge($this->viewData, $C6UW8); } else { $this->viewData[$C6UW8] = $cBDsM; } return $this; } public function pageTitle($tPNKp = null) { goto jRf3z; jRf3z: if (null === $tPNKp) { return $this->pageTitle; } goto yfbUw; yfbUw: $this->pageTitle = $tPNKp; goto YDKnc; YDKnc: return $this; goto FD1bA; FD1bA: } public function pageKeywords($w6dcb = null) { goto rgsfD; dmBnI: return $this; goto LlD9F; zCAuF: $this->pageKeywords = $w6dcb; goto dmBnI; rgsfD: if (null === $w6dcb) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto zCAuF; LlD9F: } public function pageDescription($enlVM = null) { goto GNMq2; VhjFT: return $this; goto Ft2vP; ncSfd: $this->pageDescription = $enlVM; goto VhjFT; GNMq2: if (null === $enlVM) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto ncSfd; Ft2vP: } private function addRow(Row $tEaF3) { $this->rows[] = $tEaF3; } public function build() { goto lIsa7; byh9O: return $jMvVI; goto El_XK; VAHJ2: $jMvVI = ob_get_contents(); goto RMqVU; UbRL_: foreach ($this->rows as $tEaF3) { if ($tEaF3 instanceof Buildable) { $tEaF3->build(); } else { echo $tEaF3; } } goto VAHJ2; RMqVU: ob_end_clean(); goto byh9O; lIsa7: ob_start(); goto UbRL_; El_XK: } public function handleGrid($H0Ja4) { if (Request::isPost()) { return $H0Ja4->request(); } return $this; } public function handleForm($dBWZm, $liNDm, array $dTnlu = null) { if (Request::isPost()) { return $dBWZm->formRequest($liNDm, $dTnlu); } return $this; } public function render() { $dTnlu = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($dTnlu, $this->viewData))->render(); } }