<?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($dMLhR = null) { $vrSVj = InputPackage::buildFromInput(); return $vrSVj->getInteger('_copyId', $dMLhR); } public static function scope($dMLhR = null) { $vrSVj = InputPackage::buildFromInput(); return $vrSVj->getTrimString('_scope', $dMLhR); } public static function id() { goto rWKtq; XdjZg: if (!$yU7nJ) { $yU7nJ = $vrSVj->getInteger('id'); } goto xi5kc; w2O5z: $yU7nJ = $vrSVj->getInteger('_id'); goto XdjZg; rWKtq: $vrSVj = InputPackage::buildFromInput(); goto w2O5z; xi5kc: return $yU7nJ; goto zxqyD; zxqyD: } public static function ids() { goto lIy4x; h2zCG: foreach (explode(',', $yU7nJ) as $kM8qX) { $w4eFc[] = intval($kM8qX); } goto A3Cf_; A3Cf_: return $w4eFc; goto K2FHs; lIy4x: $vrSVj = InputPackage::buildFromInput(); goto bDCPQ; gIgsl: $w4eFc = array(); goto h2zCG; bDCPQ: $yU7nJ = $vrSVj->getTrimString('_id'); goto FPTzc; FPTzc: if (!$yU7nJ) { $yU7nJ = $vrSVj->getTrimString('id'); if (empty($yU7nJ)) { $yU7nJ = $vrSVj->getTrimString('ids'); } } goto gIgsl; K2FHs: } public static function registerRouteResource($Tx0ze, $ogfq7) { goto H4G0F; vZrF5: Route::match(array('get', 'post'), "{$Tx0ze}/add", "{$ogfq7}@add"); goto Ud2xe; Ud2xe: Route::match(array('get', 'post'), "{$Tx0ze}/edit", "{$ogfq7}@edit"); goto Wvc4g; Y8CLZ: Route::match(array('post'), "{$Tx0ze}/sort", "{$ogfq7}@sort"); goto YO2y2; H4G0F: Route::match(array('get', 'post'), "{$Tx0ze}", "{$ogfq7}@index"); goto vZrF5; EmEso: Route::match(array('get'), "{$Tx0ze}/show", "{$ogfq7}@show"); goto Y8CLZ; Wvc4g: Route::match(array('post'), "{$Tx0ze}/delete", "{$ogfq7}@delete"); goto EmEso; YO2y2: } public static function registerGridResource(Grid $FGotH, $ogfq7, $ACVUe = array()) { goto xZhov; p2Us_: if ($FGotH->canSort() && ($ik1Qg = action($ogfq7 . '@sort', $ACVUe))) { $FGotH->urlSort($ik1Qg); } goto Qv5q7; mHbhD: if ($FGotH->canDelete() && ($ik1Qg = action($ogfq7 . '@delete', $ACVUe))) { $FGotH->urlDelete($ik1Qg); } goto dbK0m; dbK0m: if ($FGotH->canShow() && ($ik1Qg = action($ogfq7 . '@show', $ACVUe))) { $FGotH->urlShow($ik1Qg); } goto p2Us_; Biwwv: if ($FGotH->canImport() && ($ik1Qg = action($ogfq7 . '@import', $ACVUe))) { $FGotH->urlImport($ik1Qg); } goto RsKpg; Qv5q7: if ($FGotH->canExport() && ($ik1Qg = action($ogfq7 . '@export', $ACVUe))) { $FGotH->urlExport($ik1Qg); } goto Biwwv; xZhov: if ($FGotH->canAdd() && ($ik1Qg = action($ogfq7 . '@add', $ACVUe))) { switch ($FGotH->engine()) { case GridEngine::TREE_MASS: goto kFe6c; kFe6c: $vrSVj = InputPackage::buildFromInput(); goto UOwyO; W0oGl: break; goto U9jch; u52Yq: $LBO09['_pid'] = $vrSVj->get('_pid', $FGotH->treeRootPid()); goto L3Cbe; L3Cbe: $FGotH->urlAdd($ik1Qg . (strpos($ik1Qg, '?') > 0 ? '&' : '?') . http_build_query($LBO09)); goto W0oGl; UOwyO: $LBO09 = array(); goto u52Yq; U9jch: default: $FGotH->urlAdd($ik1Qg); break; } } goto tzHAs; tzHAs: if ($FGotH->canEdit() && ($ik1Qg = action($ogfq7 . '@edit', $ACVUe))) { $FGotH->urlEdit($ik1Qg); } goto mHbhD; RsKpg: } public static function jsGridRefresh($EqYVi = 0) { return "[js]window.__grids.get({$EqYVi}).lister.refresh();"; } public static function jsDialogCloseAndParentGridRefresh($EqYVi = 0) { return "[js]parent.__grids.get({$EqYVi}).lister.refresh();__dialogClose();"; } public static function jsDialogClose() { return '[js]__dialogClose();'; } public static function jsDialogCloseAndParentRefresh() { return '[js]parent.location.reload();'; } public static function adminRedirectOrTabClose($ik1Qg) { goto f3c6p; qj9Nl: if (View::shared('_isTab')) { $FXYNf = '[tab-close]'; } goto dtJei; f3c6p: $FXYNf = modstart_admin_url($ik1Qg); goto qj9Nl; dtJei: return $FXYNf; goto oFHtA; oFHtA: } public static function adminUrlWithTab($ik1Qg, $LBO09 = array()) { if (View::shared('_isTab')) { $LBO09['_is_tab'] = 1; } return modstart_admin_url($ik1Qg, $LBO09); } }