<?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($EJXfL, $fKa0c) { $yP7h6 = $EJXfL ? $EJXfL . ' ' . L($fKa0c) : L($fKa0c); return isset($this->pageTitle) ? $this->pageTitle : $yP7h6; } private function getForm() { goto tJcTb; tJcTb: $u4AHU = $this->form(); goto a5lIX; a5lIX: $u4AHU->showSubmit(false)->showReset(false); goto hzTzc; hzTzc: return $u4AHU; goto TWWX0; TWWX0: } public function add(AdminDialogPage $BcS7S) { goto kysy_; kysy_: $u4AHU = $this->getForm(); goto h6G0c; h6G0c: if (Request::isPost()) { AdminPermission::demoCheck(); return $u4AHU->addRequest(); } goto JPjmr; JPjmr: return $BcS7S->pageTitle($this->computeTitleForm($u4AHU->title(), 'Add'))->body($u4AHU->add()); goto cDjxD; cDjxD: } public function edit(AdminDialogPage $BcS7S) { goto p_1p3; p_1p3: $u4AHU = $this->getForm(); goto hutJg; sG7u0: return $BcS7S->pageTitle($this->computeTitleForm($u4AHU->title(), 'Edit'))->body($u4AHU->edit(CRUDUtil::id())); goto c0p7K; hutJg: if (Request::isPost()) { AdminPermission::demoCheck(); return $u4AHU->editRequest(CRUDUtil::id()); } goto sG7u0; c0p7K: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }