<?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($btrD9) { array_unshift($this->pagePrepend, $btrD9); } public function render() { goto zDDiU; SoStH: $this->page->body($TA0kd); goto uFz80; zDDiU: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $V563N) { $this->page->row($V563N); } } goto T_AUe; T_AUe: $TA0kd = $this->form; goto gr04o; gr04o: if (!$this->config['disableBoxWrap']) { $TA0kd = new Box($this->form, $this->page->pageTitle()); } goto SoStH; uFz80: return $this->page->render(); goto PhLLR; PhLLR: } public function perform($V563N = null, $Yzz3F = null) { goto qDz7G; uF1Hi: return $this; goto DRfP9; u0DrB: $this->form->fillFields(); goto uF1Hi; qDz7G: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $mjvnb) use($Yzz3F) { if ($Yzz3F) { $gbVzz = call_user_func($Yzz3F, $mjvnb); if (null !== $gbVzz) { return $gbVzz; } } else { $da426 = modstart_config(); foreach ($mjvnb->dataForming() as $F_a6B => $JiRHR) { $da426->set($F_a6B, $JiRHR); } } return Response::jsonSuccess(L('Save Success')); }); } goto GR87j; gtxLb: $this->form->item(RepositoryUtil::itemFromArray($V563N)); goto u0DrB; GR87j: if (null === $V563N) { goto EcPED; Zb3NY: $da426 = modstart_config(); goto moJ6u; moJ6u: foreach ($this->form->fields() as $pu1ro) { goto uIeLp; fnu9M: if ($s5jGH) { $JiRHR = modstart_config($pu1ro->column()); } else { $JiRHR = null; } goto FD3sP; EPb7X: $V563N[$pu1ro->column()] = $JiRHR; goto pWlJd; FD3sP: if (is_array($JiRHR)) { $JiRHR = json_encode($JiRHR, JSON_UNESCAPED_UNICODE); } goto EPb7X; uIeLp: if ($pu1ro->isLayoutField()) { continue; } goto XxRvS; XxRvS: $s5jGH = $da426->has($pu1ro->column()); goto fnu9M; pWlJd: } goto FQEMW; EcPED: $V563N = array(); goto Zb3NY; FQEMW: } else { if (false === $V563N) { $V563N = array(); foreach ($this->form->fields() as $pu1ro) { if ($pu1ro->isLayoutField()) { continue; } $V563N[$pu1ro->column()] = null; } } } goto gtxLb; DRfP9: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($oAyDf) { goto J0p4x; q2UDT: return $this; goto vafKG; okyYD: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $jkTHm . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $jkTHm . 'Content">' . $oAyDf . '</div>
<script>$(function(){ $("#' . $jkTHm . 'Placeholder").css("height",20+$("#' . $jkTHm . 'Content").height()+"px"); });</script>
'); goto q2UDT; J0p4x: $jkTHm = IdUtil::generate('ContentFixedBottomContent'); goto okyYD; vafKG: } public function __call($XggBq, $lUGZC) { goto pP_Wi; pP_Wi: if (isset($this->config[$XggBq])) { $this->config[$XggBq] = $lUGZC[0]; return $this; } goto ADjs3; ADjs3: if (method_exists($this->page, $XggBq)) { return $this->page->{$XggBq}(...$lUGZC); } goto uT2VD; uT2VD: return $this->form->{$XggBq}(...$lUGZC); goto EYtUO; EYtUO: } }