<?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($qqJ9g = null) { $do_OL = InputPackage::buildFromInput(); return $do_OL->getInteger('_copyId', $qqJ9g); } public static function scope($qqJ9g = null) { $do_OL = InputPackage::buildFromInput(); return $do_OL->getTrimString('_scope', $qqJ9g); } public static function id() { goto jGwdq; jGwdq: $do_OL = InputPackage::buildFromInput(); goto DKRq0; DKRq0: $jkTHm = $do_OL->getInteger('_id'); goto tU28A; tU28A: if (!$jkTHm) { $jkTHm = $do_OL->getInteger('id'); } goto XIOs7; XIOs7: return $jkTHm; goto nkepp; nkepp: } public static function ids() { goto kRqJm; HNWjO: return $l912e; goto cQRGx; kRqJm: $do_OL = InputPackage::buildFromInput(); goto pSESn; W5cEZ: $l912e = array(); goto U1xQq; U1xQq: foreach (explode(',', $jkTHm) as $JhHfm) { $l912e[] = intval($JhHfm); } goto HNWjO; f5NZz: if (!$jkTHm) { $jkTHm = $do_OL->getTrimString('id'); if (empty($jkTHm)) { $jkTHm = $do_OL->getTrimString('ids'); } } goto W5cEZ; pSESn: $jkTHm = $do_OL->getTrimString('_id'); goto f5NZz; cQRGx: } public static function registerRouteResource($F1pdf, $AEqP7) { goto oJUcN; MRtma: Route::match(array('get'), "{$F1pdf}/show", "{$AEqP7}@show"); goto dyS89; XRTl3: Route::match(array('get', 'post'), "{$F1pdf}/edit", "{$AEqP7}@edit"); goto zA5tz; XiMrK: Route::match(array('get', 'post'), "{$F1pdf}/add", "{$AEqP7}@add"); goto XRTl3; zA5tz: Route::match(array('post'), "{$F1pdf}/delete", "{$AEqP7}@delete"); goto MRtma; oJUcN: Route::match(array('get', 'post'), "{$F1pdf}", "{$AEqP7}@index"); goto XiMrK; dyS89: Route::match(array('post'), "{$F1pdf}/sort", "{$AEqP7}@sort"); goto KlAoC; KlAoC: } public static function registerGridResource(Grid $BtYIX, $AEqP7, $pmJAc = array()) { goto FQPVg; NvVJd: if ($BtYIX->canSort() && ($XVqXz = action($AEqP7 . '@sort', $pmJAc))) { $BtYIX->urlSort($XVqXz); } goto RaGE1; r9E5Z: if ($BtYIX->canEdit() && ($XVqXz = action($AEqP7 . '@edit', $pmJAc))) { $BtYIX->urlEdit($XVqXz); } goto CmDyc; xXoMW: if ($BtYIX->canShow() && ($XVqXz = action($AEqP7 . '@show', $pmJAc))) { $BtYIX->urlShow($XVqXz); } goto NvVJd; CmDyc: if ($BtYIX->canDelete() && ($XVqXz = action($AEqP7 . '@delete', $pmJAc))) { $BtYIX->urlDelete($XVqXz); } goto xXoMW; FQPVg: if ($BtYIX->canAdd() && ($XVqXz = action($AEqP7 . '@add', $pmJAc))) { switch ($BtYIX->engine()) { case GridEngine::TREE_MASS: goto iYwjP; QdQwB: $xaAIg['_pid'] = $do_OL->get('_pid', $BtYIX->treeRootPid()); goto pCBk3; qhh6O: break; goto yKIG5; pCBk3: $BtYIX->urlAdd($XVqXz . (strpos($XVqXz, '?') > 0 ? '&' : '?') . http_build_query($xaAIg)); goto qhh6O; iYwjP: $do_OL = InputPackage::buildFromInput(); goto IBsem; IBsem: $xaAIg = array(); goto QdQwB; yKIG5: default: $BtYIX->urlAdd($XVqXz); break; } } goto r9E5Z; RaGE1: if ($BtYIX->canExport() && ($XVqXz = action($AEqP7 . '@export', $pmJAc))) { $BtYIX->urlExport($XVqXz); } goto qp7zt; qp7zt: if ($BtYIX->canImport() && ($XVqXz = action($AEqP7 . '@import', $pmJAc))) { $BtYIX->urlImport($XVqXz); } goto Md0qW; Md0qW: } public static function jsGridRefresh($aDVv6 = 0) { return "[js]window.__grids.get({$aDVv6}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($aDVv6 = 0) { return "[js]parent.__grids.get({$aDVv6}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($XVqXz) { goto hj4nZ; hj4nZ: $pdDxW = modstart_admin_url($XVqXz); goto FzGnP; FzGnP: if (View::shared('_isTab')) { $pdDxW = '[tab-close]'; } goto uj52Q; uj52Q: return $pdDxW; goto o2ltp; o2ltp: } public static function adminUrlWithTab($XVqXz, $xaAIg = array()) { if (View::shared('_isTab')) { $xaAIg['_is_tab'] = 1; } return modstart_admin_url($XVqXz, $xaAIg); } }