<?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() { $kFc4w = InputPackage::buildFromInput(); return $kFc4w->getInteger('_copyId'); } public static function id() { goto ILg69; ALCqv: if (!$T6TGt) { $T6TGt = $kFc4w->getInteger('id'); } goto ott6p; ILg69: $kFc4w = InputPackage::buildFromInput(); goto WYLDw; WYLDw: $T6TGt = $kFc4w->getInteger('_id'); goto ALCqv; ott6p: return $T6TGt; goto iw7Bu; iw7Bu: } public static function ids() { goto wMtot; jYr89: $T6TGt = $kFc4w->getTrimString('_id'); goto ZIz6v; wMtot: $kFc4w = InputPackage::buildFromInput(); goto jYr89; ZIz6v: if (!$T6TGt) { $T6TGt = $kFc4w->getTrimString('id'); if (empty($T6TGt)) { $T6TGt = $kFc4w->getTrimString('ids'); } } goto cAz6R; QhXb5: return $DQL3P; goto fbW8a; OQ8UM: foreach (explode(',', $T6TGt) as $MqJHJ) { $DQL3P[] = intval($MqJHJ); } goto QhXb5; cAz6R: $DQL3P = array(); goto OQ8UM; fbW8a: } public static function registerRouteResource($HTQyg, $cTFJ4) { goto gwjyb; mYsRU: Route::match(array('post'), "{$HTQyg}/delete", "{$cTFJ4}@delete"); goto cReun; fK9hL: Route::match(array('get', 'post'), "{$HTQyg}/edit", "{$cTFJ4}@edit"); goto mYsRU; EFGd_: Route::match(array('get', 'post'), "{$HTQyg}/add", "{$cTFJ4}@add"); goto fK9hL; cReun: Route::match(array('get'), "{$HTQyg}/show", "{$cTFJ4}@show"); goto rvBT6; rvBT6: Route::match(array('post'), "{$HTQyg}/sort", "{$cTFJ4}@sort"); goto Wwwb8; gwjyb: Route::match(array('get', 'post'), "{$HTQyg}", "{$cTFJ4}@index"); goto EFGd_; Wwwb8: } public static function registerGridResource(Grid $TzF5r, $cTFJ4, $qHLCM = array()) { goto ql8RL; OSI9o: if ($TzF5r->canDelete() && ($m2Dmo = action($cTFJ4 . '@delete', $qHLCM))) { $TzF5r->urlDelete($m2Dmo); } goto xG7oB; slhky: if ($TzF5r->canSort() && ($m2Dmo = action($cTFJ4 . '@sort', $qHLCM))) { $TzF5r->urlSort($m2Dmo); } goto Ez2K6; ql8RL: if ($TzF5r->canAdd() && ($m2Dmo = action($cTFJ4 . '@add', $qHLCM))) { switch ($TzF5r->engine()) { case GridEngine::TREE_MASS: goto cPjeX; cPjeX: $kFc4w = InputPackage::buildFromInput(); goto AoiTp; sbU35: $sFfhd['_pid'] = $kFc4w->get('_pid', $TzF5r->treeRootPid()); goto WDBut; WDBut: $TzF5r->urlAdd($m2Dmo . (strpos($m2Dmo, '?') > 0 ? '&' : '?') . http_build_query($sFfhd)); goto PtGgQ; AoiTp: $sFfhd = array(); goto sbU35; PtGgQ: break; goto Z4hqB; Z4hqB: default: $TzF5r->urlAdd($m2Dmo); break; } } goto tNorH; xG7oB: if ($TzF5r->canShow() && ($m2Dmo = action($cTFJ4 . '@show', $qHLCM))) { $TzF5r->urlShow($m2Dmo); } goto slhky; nHka8: if ($TzF5r->canImport() && ($m2Dmo = action($cTFJ4 . '@import', $qHLCM))) { $TzF5r->urlImport($m2Dmo); } goto ZFaEa; tNorH: if ($TzF5r->canEdit() && ($m2Dmo = action($cTFJ4 . '@edit', $qHLCM))) { $TzF5r->urlEdit($m2Dmo); } goto OSI9o; Ez2K6: if ($TzF5r->canExport() && ($m2Dmo = action($cTFJ4 . '@export', $qHLCM))) { $TzF5r->urlExport($m2Dmo); } goto nHka8; ZFaEa: } public static function jsGridRefresh($K_IJ6 = 0) { return "[js]window.__grids.get({$K_IJ6}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($K_IJ6 = 0) { return "[js]parent.__grids.get({$K_IJ6}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($m2Dmo) { goto jWh2x; rEfB6: if (View::shared('_isTab')) { $N_ib3 = '[tab-close]'; } goto S4MeJ; S4MeJ: return $N_ib3; goto JZ_cl; jWh2x: $N_ib3 = modstart_admin_url($m2Dmo); goto rEfB6; JZ_cl: } public static function adminUrlWithTab($m2Dmo, $sFfhd = array()) { if (View::shared('_isTab')) { $sFfhd['_is_tab'] = 1; } return modstart_admin_url($m2Dmo, $sFfhd); } }