<?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($brUx_) { array_unshift($this->pagePrepend, $brUx_); } public function render() { goto NzhHh; Cdy9p: return $this->page->render(); goto t3CEF; lyBz1: $this->page->body($ukWAB); goto Cdy9p; NzhHh: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $OV1o4) { $this->page->row($OV1o4); } } goto UzZ6j; UzZ6j: $ukWAB = $this->form; goto ItnwC; ItnwC: if (!$this->config['disableBoxWrap']) { $ukWAB = new Box($this->form, $this->page->pageTitle()); } goto lyBz1; t3CEF: } public function perform($OV1o4 = null, $uTSeU = null) { goto ExJ4f; aAOmG: $this->form->fillFields(); goto RvJzE; REEig: if (null === $OV1o4) { goto wfAN1; kfAZH: foreach ($this->form->fields() as $E8QRJ) { goto oDPFs; ftXtB: if ($d3AEr) { $Q0rz2 = modstart_config($E8QRJ->column()); } else { $Q0rz2 = null; } goto gHM29; BPFJL: $d3AEr = $j3fMq->has($E8QRJ->column()); goto ftXtB; gHM29: if (is_array($Q0rz2)) { $Q0rz2 = SerializeUtil::jsonEncode($Q0rz2); } goto nIrCC; oDPFs: if ($E8QRJ->isLayoutField()) { continue; } goto BPFJL; nIrCC: $OV1o4[$E8QRJ->column()] = $Q0rz2; goto JXisY; JXisY: } goto HhMX6; wfAN1: $OV1o4 = array(); goto C4p3P; C4p3P: $j3fMq = modstart_config(); goto kfAZH; HhMX6: } else { if (false === $OV1o4) { $OV1o4 = array(); foreach ($this->form->fields() as $E8QRJ) { if ($E8QRJ->isLayoutField()) { continue; } $OV1o4[$E8QRJ->column()] = null; } } } goto MqMhU; ExJ4f: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $yfPYJ) use($uTSeU) { if ($uTSeU) { $Z5nZL = call_user_func($uTSeU, $yfPYJ); if (null !== $Z5nZL) { return $Z5nZL; } } else { $j3fMq = modstart_config(); foreach ($yfPYJ->dataForming() as $pztz4 => $Q0rz2) { $j3fMq->set($pztz4, $Q0rz2); } } return Response::jsonSuccess(L('Save Success')); }); } goto REEig; RvJzE: return $this; goto XSiom; MqMhU: $this->form->item(RepositoryUtil::itemFromArray($OV1o4)); goto aAOmG; XSiom: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($Q1WHV) { goto IVCHh; Yvtvd: return $this; goto e4ZjH; IVCHh: $D_1N9 = IdUtil::generate('ContentFixedBottomContent'); goto GjJ9P; GjJ9P: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $D_1N9 . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $D_1N9 . 'Content">' . $Q1WHV . '</div>
<script>$(function(){ $("#' . $D_1N9 . 'Placeholder").css("height",20+$("#' . $D_1N9 . 'Content").height()+"px"); });</script>
'); goto Yvtvd; e4ZjH: } public function __call($f0dxO, $RSGSj) { goto KtWJJ; RBldR: return $this->form->{$f0dxO}(...$RSGSj); goto cLZ0o; HHxkx: if (method_exists($this->page, $f0dxO)) { return $this->page->{$f0dxO}(...$RSGSj); } goto RBldR; KtWJJ: if (isset($this->config[$f0dxO])) { $this->config[$f0dxO] = $RSGSj[0]; return $this; } goto HHxkx; cLZ0o: } }