<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Concern; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Layout\AdminDialogPage; use ModStart\Admin\Layout\AdminPage; use ModStart\Core\Input\Request; use ModStart\Core\Util\CRUDUtil; use ModStart\Form\Form; use ModStart\Grid\Grid; trait HasAdminForm { private function computeTitleForm($txUYE, $YdB39) { $XWWOD = $txUYE ? $txUYE . ' ' . L($YdB39) : L($YdB39); return $this->pageTitle ? $this->pageTitle : $XWWOD; } private function getForm() { goto EZeEU; EZeEU: $Pl0Cf = $this->form(); goto klZZV; klZZV: $Pl0Cf->showSubmit(false)->showReset(false); goto TjHre; TjHre: return $Pl0Cf; goto vDcjR; vDcjR: } public function add(AdminDialogPage $gt42Q) { goto m9WnD; SKjxX: if (Request::isPost()) { AdminPermission::demoCheck(); return $Pl0Cf->addRequest(); } goto W9CH2; m9WnD: $Pl0Cf = $this->getForm(); goto SKjxX; W9CH2: return $gt42Q->pageTitle($this->computeTitleForm($Pl0Cf->title(), 'Add'))->body($Pl0Cf->add()); goto DlBQC; DlBQC: } public function edit(AdminDialogPage $gt42Q) { goto Ce8Um; Ce8Um: $Pl0Cf = $this->getForm(); goto GEUq_; GEUq_: if (Request::isPost()) { AdminPermission::demoCheck(); return $Pl0Cf->editRequest(CRUDUtil::id()); } goto OCymk; OCymk: return $gt42Q->pageTitle($this->computeTitleForm($Pl0Cf->title(), 'Edit'))->body($Pl0Cf->edit(CRUDUtil::id())); goto fZ0gu; fZ0gu: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }