<?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($iLXxb) { array_unshift($this->pagePrepend, $iLXxb); } public function render() { goto vuec3; pp1bR: $this->page->body($SfcOB); goto W_Kkb; vuec3: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $Xvngd) { $this->page->row($Xvngd); } } goto Mjkfv; Mjkfv: $SfcOB = $this->form; goto yzOvR; yzOvR: if (!$this->config['disableBoxWrap']) { $SfcOB = new Box($this->form, $this->page->pageTitle()); } goto pp1bR; W_Kkb: return $this->page->render(); goto DgW1H; DgW1H: } public function perform($Xvngd = null, $SO11l = null) { goto zOeLB; zOeLB: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $aDbJm) use($SO11l) { if ($SO11l) { $f3Nqc = call_user_func($SO11l, $aDbJm); if (null !== $f3Nqc) { return $f3Nqc; } } else { $O348k = modstart_config(); foreach ($aDbJm->dataForming() as $RTHJ6 => $F6Fus) { $O348k->set($RTHJ6, $F6Fus); } } return Response::jsonSuccess(L('Save Success')); }); } goto Ua6IV; Ua6IV: if (null === $Xvngd) { goto inB7p; oM1B8: foreach ($this->form->fields() as $acdQI) { goto gSqLJ; lG2L0: if (is_array($F6Fus)) { $F6Fus = json_encode($F6Fus, JSON_UNESCAPED_UNICODE); } goto aKKUf; gSqLJ: if ($acdQI->isLayoutField()) { continue; } goto Ot9wF; Ot9wF: $JG9mE = $O348k->has($acdQI->column()); goto HXNoT; aKKUf: $Xvngd[$acdQI->column()] = $F6Fus; goto DGfSf; HXNoT: if ($JG9mE) { $F6Fus = modstart_config($acdQI->column()); } else { $F6Fus = null; } goto lG2L0; DGfSf: } goto Gw5SV; Vw8m0: $O348k = modstart_config(); goto oM1B8; inB7p: $Xvngd = array(); goto Vw8m0; Gw5SV: } else { if (false === $Xvngd) { $Xvngd = array(); foreach ($this->form->fields() as $acdQI) { if ($acdQI->isLayoutField()) { continue; } $Xvngd[$acdQI->column()] = null; } } } goto KScP3; z8TmB: return $this; goto XhVsP; KScP3: $this->form->item(RepositoryUtil::itemFromArray($Xvngd)); goto GF78P; GF78P: $this->form->fillFields(); goto z8TmB; XhVsP: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($A1nut) { goto AdBeX; UBAYQ: return $this; goto AqNHh; AdBeX: $T6TGt = IdUtil::generate('ContentFixedBottomContent'); goto BpTow; BpTow: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $T6TGt . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $T6TGt . 'Content">' . $A1nut . '</div>
<script>$(function(){ $("#' . $T6TGt . 'Placeholder").css("height",20+$("#' . $T6TGt . 'Content").height()+"px"); });</script>
'); goto UBAYQ; AqNHh: } public function __call($sQIr6, $g59Hh) { goto HiDri; LnC46: return $this->form->{$sQIr6}(...$g59Hh); goto GEfXH; HiDri: if (isset($this->config[$sQIr6])) { $this->config[$sQIr6] = $g59Hh[0]; return $this; } goto oamMA; oamMA: if (method_exists($this->page, $sQIr6)) { return $this->page->{$sQIr6}(...$g59Hh); } goto LnC46; GEfXH: } }