<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\View; use ModStart\Core\Input\InputPackage; use ModStart\Grid\Grid; use ModStart\Grid\Type\GridEngine; class CRUDUtil { public static function copyId($snkf0 = null) { $sYsuI = InputPackage::buildFromInput(); return $sYsuI->getInteger('_copyId', $snkf0); } public static function scope($snkf0 = null) { $sYsuI = InputPackage::buildFromInput(); return $sYsuI->getTrimString('_scope', $snkf0); } public static function id() { goto tJ4nq; zlyQp: $D_1N9 = $sYsuI->getInteger('_id'); goto gve9E; gve9E: if (!$D_1N9) { $D_1N9 = $sYsuI->getInteger('id'); } goto ufX3M; tJ4nq: $sYsuI = InputPackage::buildFromInput(); goto zlyQp; ufX3M: return $D_1N9; goto sIfBl; sIfBl: } public static function ids() { goto PKNUH; PKNUH: $sYsuI = InputPackage::buildFromInput(); goto CO_6x; DJ9FF: if (!$D_1N9) { $D_1N9 = $sYsuI->getTrimString('id'); if (empty($D_1N9)) { $D_1N9 = $sYsuI->getTrimString('ids'); } } goto h2UIX; h2UIX: $OZklk = array(); goto kWJdy; kWJdy: foreach (explode(',', $D_1N9) as $tMyPy) { $OZklk[] = intval($tMyPy); } goto ldrDX; ldrDX: return $OZklk; goto DxlBK; CO_6x: $D_1N9 = $sYsuI->getTrimString('_id'); goto DJ9FF; DxlBK: } public static function registerRouteResource($BSuqj, $UfDw1) { goto zHW46; MLCVd: Route::match(array('get'), "{$BSuqj}/show", "{$UfDw1}@show"); goto rGPox; A3ALS: Route::match(array('get', 'post'), "{$BSuqj}/add", "{$UfDw1}@add"); goto XaJIH; zHW46: Route::match(array('get', 'post'), "{$BSuqj}", "{$UfDw1}@index"); goto A3ALS; XaJIH: Route::match(array('get', 'post'), "{$BSuqj}/edit", "{$UfDw1}@edit"); goto waEj2; rGPox: Route::match(array('post'), "{$BSuqj}/sort", "{$UfDw1}@sort"); goto jSE82; waEj2: Route::match(array('post'), "{$BSuqj}/delete", "{$UfDw1}@delete"); goto MLCVd; jSE82: } public static function registerGridResource(Grid $cRz_h, $UfDw1, $AXgEz = array()) { goto PhNvJ; zlKHz: if ($cRz_h->canShow() && ($tpgiq = action($UfDw1 . '@show', $AXgEz))) { $cRz_h->urlShow($tpgiq); } goto CZABv; wGmG7: if ($cRz_h->canEdit() && ($tpgiq = action($UfDw1 . '@edit', $AXgEz))) { $cRz_h->urlEdit($tpgiq); } goto aZyKo; aZyKo: if ($cRz_h->canDelete() && ($tpgiq = action($UfDw1 . '@delete', $AXgEz))) { $cRz_h->urlDelete($tpgiq); } goto zlKHz; tyV7D: if ($cRz_h->canImport() && ($tpgiq = action($UfDw1 . '@import', $AXgEz))) { $cRz_h->urlImport($tpgiq); } goto NZt45; eGpaT: if ($cRz_h->canExport() && ($tpgiq = action($UfDw1 . '@export', $AXgEz))) { $cRz_h->urlExport($tpgiq); } goto tyV7D; PhNvJ: if ($cRz_h->canAdd() && ($tpgiq = action($UfDw1 . '@add', $AXgEz))) { switch ($cRz_h->engine()) { case GridEngine::TREE_MASS: goto mB9z_; JKiY2: $vw3jY = array(); goto j6ccK; r43LA: break; goto NPSZx; aP1GG: $cRz_h->urlAdd($tpgiq . (strpos($tpgiq, '?') > 0 ? '&' : '?') . http_build_query($vw3jY)); goto r43LA; mB9z_: $sYsuI = InputPackage::buildFromInput(); goto JKiY2; j6ccK: $vw3jY['_pid'] = $sYsuI->get('_pid', $cRz_h->treeRootPid()); goto aP1GG; NPSZx: default: $cRz_h->urlAdd($tpgiq); break; } } goto wGmG7; CZABv: if ($cRz_h->canSort() && ($tpgiq = action($UfDw1 . '@sort', $AXgEz))) { $cRz_h->urlSort($tpgiq); } goto eGpaT; NZt45: } public static function jsGridRefresh($xlsSz = 0) { return "[js]window.__grids.get({$xlsSz}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($xlsSz = 0) { return "[js]parent.__grids.get({$xlsSz}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($tpgiq) { goto vb3wu; cEMk2: if (View::shared('_isTab')) { $RpkmH = '[tab-close]'; } goto E7tii; vb3wu: $RpkmH = modstart_admin_url($tpgiq); goto cEMk2; E7tii: return $RpkmH; goto krsH0; krsH0: } public static function adminUrlWithTab($tpgiq, $vw3jY = array()) { if (View::shared('_isTab')) { $vw3jY['_is_tab'] = 1; } return modstart_admin_url($tpgiq, $vw3jY); } }