<?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\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($LZohU) { array_unshift($this->pagePrepend, $LZohU); } public function render() { goto q94iD; n6Hef: $this->page->body($oDbC2); goto ooW7J; q94iD: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $ZpLX1) { $this->page->row($ZpLX1); } } goto Af3YK; Af3YK: $oDbC2 = $this->form; goto gyOOG; gyOOG: if (!$this->config['disableBoxWrap']) { $oDbC2 = new Box($this->form, $this->page->pageTitle()); } goto n6Hef; ooW7J: return $this->page->render(); goto z3lai; z3lai: } public function perform($ZpLX1 = null, $aCnQE = null) { goto DwR_C; DwR_C: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $LEyIF) use($aCnQE) { if ($aCnQE) { $pTwJr = call_user_func($aCnQE, $LEyIF); if (null !== $pTwJr) { return $pTwJr; } } else { $jmXHX = modstart_config(); foreach ($LEyIF->dataForming() as $plrwN => $uTz0e) { $jmXHX->set($plrwN, $uTz0e); } } return Response::jsonSuccess(L('Save Success')); }); } goto WDni6; aJvko: return $this; goto gX1uL; rbL9d: $this->form->item(RepositoryUtil::itemFromArray($ZpLX1)); goto bomJ5; WDni6: if (null === $ZpLX1) { goto TKrbw; mVZo3: foreach ($this->form->fields() as $Lgjfa) { goto Rsv6t; wLL_H: $ZpLX1[$Lgjfa->column()] = $uTz0e; goto XW01F; RqTqa: if ($i2sGb) { $uTz0e = modstart_config($Lgjfa->column()); } else { $uTz0e = null; } goto NKBtE; NKBtE: if (is_array($uTz0e)) { $uTz0e = json_encode($uTz0e, JSON_UNESCAPED_UNICODE); } goto wLL_H; Rsv6t: if ($Lgjfa->isLayoutField()) { continue; } goto hkkaN; hkkaN: $i2sGb = $jmXHX->has($Lgjfa->column()); goto RqTqa; XW01F: } goto ZeCVW; jbqD2: $jmXHX = modstart_config(); goto mVZo3; TKrbw: $ZpLX1 = array(); goto jbqD2; ZeCVW: } else { if (false === $ZpLX1) { $ZpLX1 = array(); foreach ($this->form->fields() as $Lgjfa) { if ($Lgjfa->isLayoutField()) { continue; } $ZpLX1[$Lgjfa->column()] = null; } } } goto rbL9d; bomJ5: $this->form->fillFields(); goto aJvko; gX1uL: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($YUOG2) { goto sN32U; Dl05e: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $mK69g . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $mK69g . 'Content">' . $YUOG2 . '</div>
<script>$(function(){ $("#' . $mK69g . 'Placeholder").css("height",20+$("#' . $mK69g . 'Content").height()+"px"); });</script>
'); goto azZyp; azZyp: return $this; goto meNCH; sN32U: $mK69g = IdUtil::generate('ContentFixedBottomContent'); goto Dl05e; meNCH: } public function __call($L4owo, $nvZ9A) { goto a2itq; a2itq: if (isset($this->config[$L4owo])) { $this->config[$L4owo] = $nvZ9A[0]; return $this; } goto aiCxW; kOOXo: return $this->form->{$L4owo}(...$nvZ9A); goto aqHs_; aiCxW: if (method_exists($this->page, $L4owo)) { return $this->page->{$L4owo}(...$nvZ9A); } goto kOOXo; aqHs_: } }