<?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($Z1lY2 = null) { $vfMTB = InputPackage::buildFromInput(); return $vfMTB->getInteger('_copyId', $Z1lY2); } public static function scope($Z1lY2 = null) { $vfMTB = InputPackage::buildFromInput(); return $vfMTB->getTrimString('_scope', $Z1lY2); } public static function id() { goto BfhK1; EEVFR: $Zzend = $vfMTB->getInteger('_id'); goto hNRWR; rbZ2z: return $Zzend; goto CPFfF; BfhK1: $vfMTB = InputPackage::buildFromInput(); goto EEVFR; hNRWR: if (!$Zzend) { $Zzend = $vfMTB->getInteger('id'); } goto rbZ2z; CPFfF: } public static function ids() { goto NlTJr; i2zkn: foreach (explode(',', $Zzend) as $jqibn) { $p4SsD[] = intval($jqibn); } goto Jt4zk; Jt4zk: return $p4SsD; goto kKR1e; af3CO: $p4SsD = array(); goto i2zkn; NlTJr: $vfMTB = InputPackage::buildFromInput(); goto cpLim; cpLim: $Zzend = $vfMTB->getTrimString('_id'); goto gI1L6; gI1L6: if (!$Zzend) { $Zzend = $vfMTB->getTrimString('id'); if (empty($Zzend)) { $Zzend = $vfMTB->getTrimString('ids'); } } goto af3CO; kKR1e: } public static function registerRouteResource($hyTx0, $t7pan) { goto oliaH; K0EcF: Route::match(array('get', 'post'), "{$hyTx0}/add", "{$t7pan}@add"); goto VfQ3l; oliaH: Route::match(array('get', 'post'), "{$hyTx0}", "{$t7pan}@index"); goto K0EcF; KOOuD: Route::match(array('post'), "{$hyTx0}/sort", "{$t7pan}@sort"); goto Q_Ntd; yEu30: Route::match(array('post'), "{$hyTx0}/delete", "{$t7pan}@delete"); goto EdFje; EdFje: Route::match(array('get'), "{$hyTx0}/show", "{$t7pan}@show"); goto KOOuD; VfQ3l: Route::match(array('get', 'post'), "{$hyTx0}/edit", "{$t7pan}@edit"); goto yEu30; Q_Ntd: } public static function registerGridResource(Grid $H0Ja4, $t7pan, $mattM = array()) { goto WQAKq; DB_B0: if ($H0Ja4->canDelete() && ($MiLaY = action($t7pan . '@delete', $mattM))) { $H0Ja4->urlDelete($MiLaY); } goto buHsI; WQAKq: if ($H0Ja4->canAdd() && ($MiLaY = action($t7pan . '@add', $mattM))) { switch ($H0Ja4->engine()) { case GridEngine::TREE_MASS: goto KsJXx; SfgUC: $H0Ja4->urlAdd($MiLaY . (strpos($MiLaY, '?') > 0 ? '&' : '?') . http_build_query($nYIOS)); goto Gy3Vq; KsJXx: $vfMTB = InputPackage::buildFromInput(); goto n1fvA; Gy3Vq: break; goto litXV; n1fvA: $nYIOS = array(); goto kT2eO; kT2eO: $nYIOS['_pid'] = $vfMTB->get('_pid', $H0Ja4->treeRootPid()); goto SfgUC; litXV: default: $H0Ja4->urlAdd($MiLaY); break; } } goto MNtur; MNtur: if ($H0Ja4->canEdit() && ($MiLaY = action($t7pan . '@edit', $mattM))) { $H0Ja4->urlEdit($MiLaY); } goto DB_B0; buHsI: if ($H0Ja4->canShow() && ($MiLaY = action($t7pan . '@show', $mattM))) { $H0Ja4->urlShow($MiLaY); } goto easLq; TDgfa: if ($H0Ja4->canExport() && ($MiLaY = action($t7pan . '@export', $mattM))) { $H0Ja4->urlExport($MiLaY); } goto RPFFB; RPFFB: if ($H0Ja4->canImport() && ($MiLaY = action($t7pan . '@import', $mattM))) { $H0Ja4->urlImport($MiLaY); } goto gNMTW; easLq: if ($H0Ja4->canSort() && ($MiLaY = action($t7pan . '@sort', $mattM))) { $H0Ja4->urlSort($MiLaY); } goto TDgfa; gNMTW: } public static function jsGridRefresh($C6OV7 = 0) { return "[js]window.__grids.get({$C6OV7}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($C6OV7 = 0) { return "[js]parent.__grids.get({$C6OV7}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($MiLaY) { goto ESt4I; ESt4I: $EXGDr = modstart_admin_url($MiLaY); goto qV3bU; Cc9r9: return $EXGDr; goto PNxWF; qV3bU: if (View::shared('_isTab')) { $EXGDr = '[tab-close]'; } goto Cc9r9; PNxWF: } public static function adminUrlWithTab($MiLaY, $nYIOS = array()) { if (View::shared('_isTab')) { $nYIOS['_is_tab'] = 1; } return modstart_admin_url($MiLaY, $nYIOS); } }