<?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 $R6Imz = null) { if ($R6Imz instanceof Closure) { $R6Imz($this); } } public function body($DTnPC) { return $this->row($DTnPC); } public function row($DTnPC) { if ($DTnPC instanceof Closure) { goto K7Ue_; iS_gS: call_user_func($DTnPC, $Ah4uW); goto qEILT; qEILT: $this->addRow($Ah4uW); goto ZKBzE; K7Ue_: $Ah4uW = new Row(); goto iS_gS; ZKBzE: } else { $this->addRow(new Row($DTnPC)); } return $this; } public function append($DTnPC) { $this->rows[] = $DTnPC; return $this; } public function view($EdxNA = null) { goto oq10d; jr6Qf: return $this; goto yg6sX; oq10d: if (null === $EdxNA) { return $this->view; } goto TB0xG; TB0xG: $this->view = $EdxNA; goto jr6Qf; yg6sX: } public function putViewData($AfGq1, $gwXrh = null) { if (is_array($AfGq1)) { $this->viewData = array_merge($this->viewData, $AfGq1); } else { $this->viewData[$AfGq1] = $gwXrh; } return $this; } public function pageTitle($onAuN = null) { goto QEb6e; QEb6e: if (null === $onAuN) { return $this->pageTitle; } goto NoTGN; hg1wh: return $this; goto F2Z30; NoTGN: $this->pageTitle = $onAuN; goto hg1wh; F2Z30: } public function pageKeywords($OzvcR = null) { goto TpsxC; TpsxC: if (null === $OzvcR) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto MKO6x; kJgpo: return $this; goto r2pni; MKO6x: $this->pageKeywords = $OzvcR; goto kJgpo; r2pni: } public function pageDescription($M9oYg = null) { goto CT1EO; CT1EO: if (null === $M9oYg) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto F8PhW; F8PhW: $this->pageDescription = $M9oYg; goto gE32i; gE32i: return $this; goto BPHqx; BPHqx: } private function addRow(Row $Ah4uW) { $this->rows[] = $Ah4uW; } public function build() { goto NJJHt; G62ST: foreach ($this->rows as $Ah4uW) { if ($Ah4uW instanceof Buildable) { $Ah4uW->build(); } else { echo $Ah4uW; } } goto JlBzt; ybWeP: return $wvdXH; goto xQbJt; i3rFq: ob_end_clean(); goto ybWeP; JlBzt: $wvdXH = ob_get_contents(); goto i3rFq; NJJHt: ob_start(); goto G62ST; xQbJt: } public function handleGrid($fvhtX) { if (Request::isPost()) { return $fvhtX->request(); } return $this; } public function handleForm($tzSkY, $R6Imz, array $OTBPk = null) { if (Request::isPost()) { return $tzSkY->formRequest($R6Imz, $OTBPk); } return $this; } public function render() { $OTBPk = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($OTBPk, $this->viewData))->render(); } }