<?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($Nahzt) { array_unshift($this->pagePrepend, $Nahzt); } public function render() { goto e7IAI; KLh96: if (!$this->config['disableBoxWrap']) { $tbzlN = new Box($this->form, $this->page->pageTitle()); } goto SkFQE; e7IAI: if (!empty($this->pagePrepend)) { foreach ($this->pagePrepend as $El_MH) { $this->page->row($El_MH); } } goto mF7cL; SkFQE: $this->page->body($tbzlN); goto EDuV2; mF7cL: $tbzlN = $this->form; goto KLh96; EDuV2: return $this->page->render(); goto fafxC; fafxC: } public function perform($El_MH = null, $r1VBm = null) { goto uFAL9; uFAL9: if (Request::isPost()) { AdminPermission::demoCheck(); return $this->form->formRequest(function (Form $u4AHU) use($r1VBm) { if ($r1VBm) { $JOw_A = call_user_func($r1VBm, $u4AHU); if (null !== $JOw_A) { return $JOw_A; } } else { $b1rpR = modstart_config(); foreach ($u4AHU->dataForming() as $kh68j => $tHq0l) { $b1rpR->set($kh68j, $tHq0l); } } return Response::jsonSuccess(L('Save Success')); }); } goto k_XL1; oA0AB: return $this; goto mYqak; k_XL1: if (null === $El_MH) { $El_MH = array(); foreach ($this->form->fields() as $SQ6_6) { if ($SQ6_6->isLayoutField()) { continue; } $El_MH[$SQ6_6->column()] = modstart_config($SQ6_6->column(), $SQ6_6->defaultValue()); } } else { if (false === $El_MH) { $El_MH = array(); foreach ($this->form->fields() as $SQ6_6) { if ($SQ6_6->isLayoutField()) { continue; } $El_MH[$SQ6_6->column()] = null; } } } goto E_kDK; b8b9E: $this->form->fillFields(); goto oA0AB; E_kDK: $this->form->item(RepositoryUtil::itemFromArray($El_MH)); goto b8b9E; mYqak: } public function contentFixedBottomContentSave() { $this->contentFixedBottomContent('<button type="submit" class="btn btn-primary">' . L('Save') . '</button>'); } public function contentFixedBottomContent($lSp6_) { goto ixVow; ixVow: $sIQGl = IdUtil::generate('ContentFixedBottomContent'); goto EHzXc; EHzXc: $this->layoutHtml('
<div class="content-fixed-bottom-toolbox-placeholder" id="' . $sIQGl . 'Placeholder"></div>
<div class="content-fixed-bottom-toolbox" id="' . $sIQGl . 'Content">' . $lSp6_ . '</div>
<script>$(function(){ $("#' . $sIQGl . 'Placeholder").css("height",20+$("#' . $sIQGl . 'Content").height()+"px"); });</script>
'); goto vbvvH; vbvvH: return $this; goto yKsdx; yKsdx: } public function __call($rPkIY, $HPXJC) { goto KU70h; uzj3T: return $this->form->{$rPkIY}(...$HPXJC); goto U9qDG; R0a5I: if (method_exists($this->page, $rPkIY)) { return $this->page->{$rPkIY}(...$HPXJC); } goto uzj3T; KU70h: if (isset($this->config[$rPkIY])) { $this->config[$rPkIY] = $HPXJC[0]; return $this; } goto R0a5I; U9qDG: } }