<?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($Yhs9S, $JRSxY) { $IJdfw = $Yhs9S ? $Yhs9S . ' ' . L($JRSxY) : L($JRSxY); return isset($this->pageTitle) ? $this->pageTitle : $IJdfw; } private function getForm() { goto Ezy_y; Ezy_y: $tzSkY = $this->form(); goto Pt5kA; xR4YM: return $tzSkY; goto mjQZk; Pt5kA: $tzSkY->showSubmit(false)->showReset(false); goto xR4YM; mjQZk: } public function add(AdminDialogPage $z5B9p) { goto V92Ds; V92Ds: $tzSkY = $this->getForm(); goto VDCqe; MMUAe: return $z5B9p->pageTitle($this->computeTitleForm($tzSkY->title(), 'Add'))->body($tzSkY->add()); goto bbtDm; VDCqe: if (Request::isPost()) { AdminPermission::demoCheck(); return $tzSkY->addRequest(); } goto MMUAe; bbtDm: } public function edit(AdminDialogPage $z5B9p) { goto zmg6y; lZZIG: return $z5B9p->pageTitle($this->computeTitleForm($tzSkY->title(), 'Edit'))->body($tzSkY->edit(CRUDUtil::id())); goto mnmFl; zmg6y: $tzSkY = $this->getForm(); goto UWFp4; UWFp4: if (Request::isPost()) { AdminPermission::demoCheck(); return $tzSkY->editRequest(CRUDUtil::id()); } goto lZZIG; mnmFl: } public function delete() { AdminPermission::demoCheck(); return $this->getForm()->deleteRequest(CRUDUtil::ids()); } public function sort() { AdminPermission::demoCheck(); return $this->getForm()->sortRequest(CRUDUtil::id()); } }