<?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 $r1VBm = null) { if ($r1VBm instanceof Closure) { $r1VBm($this); } } public function body($rFmqf) { return $this->row($rFmqf); } public function row($rFmqf) { if ($rFmqf instanceof Closure) { goto w2rAz; JmukS: call_user_func($rFmqf, $PBpDU); goto R9sve; w2rAz: $PBpDU = new Row(); goto JmukS; R9sve: $this->addRow($PBpDU); goto cfRKo; cfRKo: } else { $this->addRow(new Row($rFmqf)); } return $this; } public function append($rFmqf) { $this->rows[] = $rFmqf; return $this; } public function view($r7m3R = null) { goto YS0Ue; yseD0: return $this; goto ujlls; YS0Ue: if (null === $r7m3R) { return $this->view; } goto SwSnC; SwSnC: $this->view = $r7m3R; goto yseD0; ujlls: } public function putViewData($peU1Z, $FT9zA = null) { if (is_array($peU1Z)) { $this->viewData = array_merge($this->viewData, $peU1Z); } else { $this->viewData[$peU1Z] = $FT9zA; } return $this; } public function pageTitle($tqaeV = null) { goto oHrES; E4aBC: $this->pageTitle = $tqaeV; goto S31kd; oHrES: if (null === $tqaeV) { return $this->pageTitle; } goto E4aBC; S31kd: return $this; goto xe4sl; xe4sl: } public function pageKeywords($wQ6nJ = null) { goto q00hY; PFCpB: $this->pageKeywords = $wQ6nJ; goto H49PT; q00hY: if (null === $wQ6nJ) { if (empty($this->pageKeywords)) { return $this->pageTitle(); } return $this->pageKeywords; } goto PFCpB; H49PT: return $this; goto laDa4; laDa4: } public function pageDescription($tecE8 = null) { goto T7uXN; jK0LC: $this->pageDescription = $tecE8; goto lxEFC; T7uXN: if (null === $tecE8) { if (empty($this->pageDescription)) { return $this->pageTitle(); } return $this->pageDescription; } goto jK0LC; lxEFC: return $this; goto o3TEq; o3TEq: } private function addRow(Row $PBpDU) { $this->rows[] = $PBpDU; } public function build() { goto Et46i; OdG5C: return $bUmyU; goto zhVio; L8Zp6: foreach ($this->rows as $PBpDU) { if ($PBpDU instanceof Buildable) { $PBpDU->build(); } else { echo $PBpDU; } } goto Nl9jO; Et46i: ob_start(); goto L8Zp6; aoLaP: ob_end_clean(); goto OdG5C; Nl9jO: $bUmyU = ob_get_contents(); goto aoLaP; zhVio: } public function handleGrid($aGu71) { if (Request::isPost()) { return $aGu71->request(); } return $this; } public function handleForm($u4AHU, $r1VBm, array $EdQjV = null) { if (Request::isPost()) { return $u4AHU->formRequest($r1VBm, $EdQjV); } return $this; } public function render() { $EdQjV = array('pageTitle' => $this->pageTitle(), 'pageKeywords' => $this->pageKeywords(), 'pageDescription' => $this->pageDescription(), 'content' => $this->build()); return view($this->view(), array_merge($EdQjV, $this->viewData))->render(); } }