<?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($n02gs, $cAQuR) { $sEiap = $n02gs ? $n02gs . ' ' . L($cAQuR) : L($cAQuR); return isset($this->pageTitle) ? $this->pageTitle : $sEiap; } private function getForm() { goto Fb8_7; RHlux: $dBWZm->showSubmit(false)->showReset(false); goto PKOCi; PKOCi: return $dBWZm; goto ulOLn; Fb8_7: $dBWZm = $this->form(); goto RHlux; ulOLn: } public function add(AdminDialogPage $DbaB3) { goto cb3NN; Q2Wl2: if (Request::isPost()) { AdminPermission::demoCheck(); return $dBWZm->addRequest(); } goto H5tjN; H5tjN: return $DbaB3->pageTitle($this->computeTitleForm($dBWZm->title(), 'Add'))->body($dBWZm->add()); goto EYaQr; cb3NN: $dBWZm = $this->getForm(); goto Q2Wl2; EYaQr: } public function edit(AdminDialogPage $DbaB3) { goto fqirA; HRgsD: if (Request::isPost()) { AdminPermission::demoCheck(); return $dBWZm->editRequest(CRUDUtil::id()); } goto kCJk7; fqirA: $dBWZm = $this->getForm(); goto HRgsD; kCJk7: return $DbaB3->pageTitle($this->computeTitleForm($dBWZm->title(), 'Edit'))->body($dBWZm->edit(CRUDUtil::id())); goto ZK3Zv; ZK3Zv: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }