<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Field\Concern\CanCascadeFields; use ModStart\Field\Type\FieldRenderMode; class SelectRemote extends AbstractField { use CanCascadeFields; protected function setup() { $this->addVariables(array('server' => '')); } public function server($P6Nu0) { $this->addVariables(array('server' => $P6Nu0)); return $this; } public function viewWithModel($wt8xl, $aioaA = 'id', $mWP70 = 'title') { $this->hookRendering(function (AbstractField $acdQI, $Xvngd, $K_IJ6) use($wt8xl, $aioaA, $mWP70) { switch ($acdQI->renderMode()) { case FieldRenderMode::DETAIL: case FieldRenderMode::GRID: goto YYVpu; X540Q: return AutoRenderedFieldValue::make($Gttsd); goto AlyEJ; pD5gL: $tlo2Q = ModelUtil::get($wt8xl, array($aioaA => $Gttsd)); goto aXXms; aXXms: if ($tlo2Q) { $Gttsd = $tlo2Q[$mWP70]; } goto X540Q; YYVpu: $Gttsd = $Xvngd[$acdQI->name()]; goto pD5gL; AlyEJ: } }); return $this; } public static function handleModel($wt8xl, $aioaA = 'id', $mWP70 = 'title', $qHLCM = array()) { goto vTF3C; CdlTw: return Response::generateSuccessData(array('options' => $nO0o6)); goto c03MI; fHzCf: $bcEDt = $sFfhd->orderBy($qHLCM['sort'][0], $qHLCM['sort'][1])->limit(10)->get(array($aioaA, $mWP70))->toArray(); goto DcRfW; DcRfW: $nO0o6 = array(); goto AXcF3; vTF3C: if (!isset($qHLCM['sort'])) { $qHLCM['sort'] = array('id', 'desc'); } goto evd86; lUmKy: if ($koASZ) { $sFfhd = $sFfhd->where($mWP70, 'like', '%' . $koASZ . '%'); } goto fHzCf; evd86: $kFc4w = InputPackage::buildFromInput(); goto KdJtE; XzajV: $sFfhd = ModelUtil::model($wt8xl); goto V4Lko; AXcF3: foreach ($bcEDt as $tlo2Q) { $nO0o6[] = array('value' => $tlo2Q[$aioaA], 'label' => $tlo2Q[$mWP70]); } goto CdlTw; KdJtE: $Gttsd = $kFc4w->getInteger('value'); goto CZqCG; V4Lko: if ($Gttsd) { $sFfhd = $sFfhd->where($aioaA, $Gttsd); } goto lUmKy; CZqCG: $koASZ = $kFc4w->getTrimString('keywords'); goto XzajV; c03MI: } }