<?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($O4nvM) { array_unshift($this->pagePrepend, $O4nvM); } public function render() { goto ZLry7; Nr9Hu: if (!$this->config['disableBoxWrap']) { $kb0d2 = new Box($this->form, $this->page->pageTitle()); } goto y8jlm; FBGi_: $kb0d2 = $this->form; goto Nr9Hu; N8Ho1: return $this->page->render(); goto H3aT0; y8jlm: $this->page->body($kb0d2); goto N8Ho1; ZLry7: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $P1uVJ) { $this->page->row($P1uVJ); } } goto FBGi_; H3aT0: } public function perform($P1uVJ = null, $liNDm = null) { goto F8NQP; TASlX: if (null === $P1uVJ) { goto Kg7Pn; kzgGL: foreach ($this->form->fields() as $Ldet7) { goto SSLt2; ww5C4: $P1uVJ[$Ldet7->column()] = $knQyJ; goto m0vl_; N3ycN: $uxAYm = $N7PdT->has($Ldet7->column()); goto mFXTP; SSLt2: if ($Ldet7->isLayoutField()) { continue; } goto N3ycN; mFXTP: if ($uxAYm) { $knQyJ = modstart_config($Ldet7->column()); } else { $knQyJ = null; } goto P26zh; P26zh: if (is_array($knQyJ)) { $knQyJ = SerializeUtil::jsonEncode($knQyJ); } goto ww5C4; m0vl_: } goto POVIX; Kg7Pn: $P1uVJ = array(); goto dx_za; dx_za: $N7PdT = modstart_config(); goto kzgGL; POVIX: } else { if (false === $P1uVJ) { $P1uVJ = array(); foreach ($this->form->fields() as $Ldet7) { if ($Ldet7->isLayoutField()) { continue; } $P1uVJ[$Ldet7->column()] = null; } } } goto tDc5s; CDlIS: $this->form->fillFields(); goto SSt1Q; SSt1Q: return $this; goto ygHiD; tDc5s: $this->form->item(RepositoryUtil::itemFromArray($P1uVJ)); goto CDlIS; F8NQP: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $dBWZm) use($liNDm) { if ($liNDm) { $bCCWW = call_user_func($liNDm, $dBWZm); if (null !== $bCCWW) { return $bCCWW; } } else { $N7PdT = modstart_config(); foreach ($dBWZm->dataForming() as $lxIPA => $knQyJ) { $N7PdT->set($lxIPA, $knQyJ); } } return Response::jsonSuccess(L('Save Success')); }); } goto TASlX; ygHiD: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($eAyzj) { goto TAA9U; ZsNjw: return $this; goto LMEoz; TAA9U: $Zzend = IdUtil::generate('ContentFixedBottomContent'); goto R1D6V; R1D6V: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $Zzend . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $Zzend . 'Content">' . $eAyzj . '</div>
<script>$(function(){ $("#' . $Zzend . 'Placeholder").css("height",20+$("#' . $Zzend . 'Content").height()+"px"); });</script>
'); goto ZsNjw; LMEoz: } public function __call($glP3G, $bY7Wp) { goto zvjL9; zvjL9: if (isset($this->config[$glP3G])) { $this->config[$glP3G] = $bY7Wp[0]; return $this; } goto bym0o; bym0o: if (method_exists($this->page, $glP3G)) { return $this->page->{$glP3G}(...$bY7Wp); } goto nqgMg; nqgMg: return $this->form->{$glP3G}(...$bY7Wp); goto gBJDd; gBJDd: } }