<?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() { $Zxpx_ = InputPackage::buildFromInput(); return $Zxpx_->getInteger('_copyId'); } public static function id() { goto vQwUi; biPI3: return $xYu70; goto ykYQe; t4UOF: if (!$xYu70) { $xYu70 = $Zxpx_->getInteger('id'); } goto biPI3; vQwUi: $Zxpx_ = InputPackage::buildFromInput(); goto atm_D; atm_D: $xYu70 = $Zxpx_->getInteger('_id'); goto t4UOF; ykYQe: } public static function ids() { goto weD3G; n9aiZ: $xYu70 = $Zxpx_->getTrimString('_id'); goto iH1bQ; M884w: $dEion = array(); goto ZOnQn; ZOnQn: foreach (explode(',', $xYu70) as $VJ5vg) { $dEion[] = intval($VJ5vg); } goto IKCGo; iH1bQ: if (!$xYu70) { $xYu70 = $Zxpx_->getTrimString('id'); if (empty($xYu70)) { $xYu70 = $Zxpx_->getTrimString('ids'); } } goto M884w; weD3G: $Zxpx_ = InputPackage::buildFromInput(); goto n9aiZ; IKCGo: return $dEion; goto mn7Ld; mn7Ld: } public static function registerRouteResource($cxyYM, $cl6c3) { goto qpS_h; Jd0dF: Route::match(array('post'), "{$cxyYM}/delete", "{$cl6c3}@delete"); goto BSGoB; hUzPW: Route::match(array('get', 'post'), "{$cxyYM}/edit", "{$cl6c3}@edit"); goto Jd0dF; qpS_h: Route::match(array('get', 'post'), "{$cxyYM}", "{$cl6c3}@index"); goto NpTzD; NpTzD: Route::match(array('get', 'post'), "{$cxyYM}/add", "{$cl6c3}@add"); goto hUzPW; BSGoB: Route::match(array('get'), "{$cxyYM}/show", "{$cl6c3}@show"); goto fgLbd; fgLbd: Route::match(array('post'), "{$cxyYM}/sort", "{$cl6c3}@sort"); goto mY1wW; mY1wW: } public static function registerGridResource(Grid $fvhtX, $cl6c3, $zlK8N = array()) { goto mzLa4; prBWv: if ($fvhtX->canImport() && ($YjgEW = action($cl6c3 . '@import', $zlK8N))) { $fvhtX->urlImport($YjgEW); } goto jReGI; mzLa4: if ($fvhtX->canAdd() && ($YjgEW = action($cl6c3 . '@add', $zlK8N))) { switch ($fvhtX->engine()) { case GridEngine::TREE_MASS: goto jje9V; zzPqH: $fvhtX->urlAdd($YjgEW . (strpos($YjgEW, '?') > 0 ? '&' : '?') . http_build_query($lpymm)); goto HAdhI; HAdhI: break; goto JHB02; MbSTc: $lpymm['_pid'] = $Zxpx_->get('_pid', $fvhtX->treeRootPid()); goto zzPqH; hz52x: $lpymm = array(); goto MbSTc; jje9V: $Zxpx_ = InputPackage::buildFromInput(); goto hz52x; JHB02: default: $fvhtX->urlAdd($YjgEW); break; } } goto lpOFE; lpOFE: if ($fvhtX->canEdit() && ($YjgEW = action($cl6c3 . '@edit', $zlK8N))) { $fvhtX->urlEdit($YjgEW); } goto eDkCw; fVj5Q: if ($fvhtX->canExport() && ($YjgEW = action($cl6c3 . '@export', $zlK8N))) { $fvhtX->urlExport($YjgEW); } goto prBWv; uRUB2: if ($fvhtX->canShow() && ($YjgEW = action($cl6c3 . '@show', $zlK8N))) { $fvhtX->urlShow($YjgEW); } goto NohOD; NohOD: if ($fvhtX->canSort() && ($YjgEW = action($cl6c3 . '@sort', $zlK8N))) { $fvhtX->urlSort($YjgEW); } goto fVj5Q; eDkCw: if ($fvhtX->canDelete() && ($YjgEW = action($cl6c3 . '@delete', $zlK8N))) { $fvhtX->urlDelete($YjgEW); } goto uRUB2; jReGI: } public static function jsGridRefresh($R80S9 = 0) { return "[js]window.__grids.get({$R80S9}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($R80S9 = 0) { return "[js]parent.__grids.get({$R80S9}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($YjgEW) { goto FDuXT; Ihwwu: return $TpLPH; goto ba7Qg; FDuXT: $TpLPH = modstart_admin_url($YjgEW); goto x6ho3; x6ho3: if (View::shared('_isTab')) { $TpLPH = '[tab-close]'; } goto Ihwwu; ba7Qg: } public static function adminUrlWithTab($YjgEW, $lpymm = array()) { if (View::shared('_isTab')) { $lpymm['_is_tab'] = 1; } return modstart_admin_url($YjgEW, $lpymm); } }