<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Concern; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Layout\AdminDialogPage; use ModStart\Core\Input\Request; use ModStart\Core\Util\CRUDUtil; use ModStart\Form\Form; trait HasAdminForm { private function computeTitleForm($LgtSN, $Hg4AG) { $g3XgV = $LgtSN ? $LgtSN . ' ' . L($Hg4AG) : L($Hg4AG); return isset($this->pageTitle) ? $this->pageTitle : $g3XgV; } private function getForm() { goto zkraV; ov50H: return $aDbJm; goto FNre1; zkraV: $aDbJm = $this->form(); goto svL8n; svL8n: $aDbJm->showSubmit(false)->showReset(false); goto ov50H; FNre1: } public function add(AdminDialogPage $FGtwZ) { goto V65E_; V65E_: $aDbJm = $this->getForm(); goto zAUMC; pQJLT: return $FGtwZ->pageTitle($this->computeTitleForm($aDbJm->title(), 'Add'))->body($aDbJm->add()); goto duEGk; zAUMC: if (Request::isPost()) { AdminPermission::demoCheck(); return $aDbJm->addRequest(); } goto pQJLT; duEGk: } public function edit(AdminDialogPage $FGtwZ) { goto T2ZVS; nh7Jd: if (Request::isPost()) { AdminPermission::demoCheck(); return $aDbJm->editRequest(CRUDUtil::id()); } goto FnFgQ; FnFgQ: return $FGtwZ->pageTitle($this->computeTitleForm($aDbJm->title(), 'Edit'))->body($aDbJm->edit(CRUDUtil::id())); goto zdNqN; T2ZVS: $aDbJm = $this->getForm(); goto nh7Jd; zdNqN: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }