<?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($tTDuu, $MfWLT) { $znmpZ = $tTDuu ? $tTDuu . ' ' . L($MfWLT) : L($MfWLT); return isset($this->pageTitle) ? $this->pageTitle : $znmpZ; } private function getForm() { goto ZXc5j; ZXc5j: $mjvnb = $this->form(); goto HTUlb; HTUlb: $mjvnb->showSubmit(false)->showReset(false); goto v40Mu; v40Mu: return $mjvnb; goto AeqNv; AeqNv: } public function add(AdminDialogPage $WibEV) { goto M8GEE; M8GEE: $mjvnb = $this->getForm(); goto Jx2zl; Jx2zl: if (Request::isPost()) { AdminPermission::demoCheck(); return $mjvnb->addRequest(); } goto mB94x; mB94x: return $WibEV->pageTitle($this->computeTitleForm($mjvnb->title(), 'Add'))->body($mjvnb->add()); goto tP1SO; tP1SO: } public function edit(AdminDialogPage $WibEV) { goto cCdPL; cCdPL: $mjvnb = $this->getForm(); goto xWXy0; xWXy0: if (Request::isPost()) { AdminPermission::demoCheck(); return $mjvnb->editRequest(CRUDUtil::id()); } goto aGELb; aGELb: return $WibEV->pageTitle($this->computeTitleForm($mjvnb->title(), 'Edit'))->body($mjvnb->edit(CRUDUtil::id())); goto QnxVk; QnxVk: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }