<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Layout; use Illuminate\Contracts\Support\Renderable; use ModStart\Admin\Auth\AdminPermission; use ModStart\Core\Dao\DynamicModel; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Core\Util\IdUtil; use ModStart\Core\Util\SerializeUtil; use ModStart\Field\AbstractField; use ModStart\Form\Form; use ModStart\Layout\Page; use ModStart\Repository\RepositoryUtil; use ModStart\Widget\Box; class AdminConfigBuilder implements Renderable { private $page; private $form; private $pagePrepend = array(); private $config = array('disableBoxWrap' => false); public function __construct() { $this->form = new Form(DynamicModel::class); $this->useFrame(); } public function form() { return $this->form; } public function page() { return $this->page; } public function useFrame() { $this->page = new AdminPage(); $this->form->showReset(false)->showSubmit(true); } public function useDialog() { $this->page = new AdminDialogPage(); $this->form->showReset(false)->showSubmit(false); } public function pagePrepend($uTsZq) { array_unshift($this->pagePrepend, $uTsZq); } public function render() { goto QxARX; AiYn7: $this->page->body($PUfPT); goto KqDzA; lQO07: if (!$this->config['disableBoxWrap']) { $PUfPT = new Box($this->form, $this->page->pageTitle()); } goto AiYn7; QGGgt: $PUfPT = $this->form; goto lQO07; KqDzA: return $this->page->render(); goto rtH3h; QxARX: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $Esk0p) { $this->page->row($Esk0p); } } goto QGGgt; rtH3h: } public function perform($Esk0p = null, $b9NqF = null) { goto Q8Nry; r5_z3: if (null === $Esk0p) { goto t77Nw; t77Nw: $Esk0p = array(); goto Ofqoi; JgFP3: foreach ($this->form->fields() as $rZfgs) { goto peSMu; N2h6Q: if ($gnhiT) { $Xz28r = modstart_config($rZfgs->column()); } else { $Xz28r = null; } goto vJ9bX; vJ9bX: if (is_array($Xz28r)) { $Xz28r = SerializeUtil::jsonEncode($Xz28r); } goto emTCw; aLb_B: $gnhiT = $ts6kE->has($rZfgs->column()); goto N2h6Q; emTCw: $Esk0p[$rZfgs->column()] = $Xz28r; goto g6Z0u; peSMu: if ($rZfgs->isLayoutField()) { continue; } goto aLb_B; g6Z0u: } goto DBuxB; Ofqoi: $ts6kE = modstart_config(); goto JgFP3; DBuxB: } else { if (false === $Esk0p) { $Esk0p = array(); foreach ($this->form->fields() as $rZfgs) { if ($rZfgs->isLayoutField()) { continue; } $Esk0p[$rZfgs->column()] = null; } } } goto o9epW; HIYVw: $this->form->fillFields(); goto rEJEb; o9epW: $this->form->item(RepositoryUtil::itemFromArray($Esk0p)); goto HIYVw; rEJEb: return $this; goto SochA; Q8Nry: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $SKFwZ) use($b9NqF) { if ($b9NqF) { $ZIe4d = call_user_func($b9NqF, $SKFwZ); if (null !== $ZIe4d) { return $ZIe4d; } } else { $ts6kE = modstart_config(); foreach ($SKFwZ->dataForming() as $B34tD => $Xz28r) { $ts6kE->set($B34tD, $Xz28r); } } return Response::jsonSuccess(L('Save Success')); }); } goto r5_z3; SochA: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($pbwAU) { goto vcrkA; wO6f1: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $yU7nJ . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $yU7nJ . 'Content">' . $pbwAU . '</div>
<script>$(function(){ $("#' . $yU7nJ . 'Placeholder").css("height",20+$("#' . $yU7nJ . 'Content").height()+"px"); });</script>
'); goto JD917; JD917: return $this; goto FyewF; vcrkA: $yU7nJ = IdUtil::generate('ContentFixedBottomContent'); goto wO6f1; FyewF: } public function __call($ZZMEd, $rxS2C) { goto TH5fq; tjVFN: if (method_exists($this->page, $ZZMEd)) { return $this->page->{$ZZMEd}(...$rxS2C); } goto K2eYO; TH5fq: if (isset($this->config[$ZZMEd])) { $this->config[$ZZMEd] = $rxS2C[0]; return $this; } goto tjVFN; K2eYO: return $this->form->{$ZZMEd}(...$rxS2C); goto HkYs3; HkYs3: } }