<?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($Tkur1) { $this->addVariables(array('server' => $Tkur1)); return $this; } public function viewWithModel($AD05J, $zIeSf = 'id', $wEvc0 = 'title') { $this->hookRendering(function (AbstractField $rZfgs, $Esk0p, $EqYVi) use($AD05J, $zIeSf, $wEvc0) { switch ($rZfgs->renderMode()) { case FieldRenderMode::DETAIL: case FieldRenderMode::GRID: goto T5C4m; T5C4m: $Mczr_ = $Esk0p[$rZfgs->name()]; goto yRf9B; bf2y2: return AutoRenderedFieldValue::make($Mczr_); goto bcKp4; yRf9B: $X8gVP = ModelUtil::get($AD05J, array($zIeSf => $Mczr_)); goto aS1pt; aS1pt: if ($X8gVP) { $Mczr_ = $X8gVP[$wEvc0]; } goto bf2y2; bcKp4: } }); return $this; } public static function handleModel($AD05J, $zIeSf = 'id', $wEvc0 = 'title', $ACVUe = array()) { goto yxgXw; E0rew: $LBO09 = ModelUtil::model($AD05J); goto EBmlu; Posuf: return Response::generateSuccessData(array('options' => $RKwZR)); goto T7nmW; ngADU: $vrSVj = InputPackage::buildFromInput(); goto j_dJY; j_dJY: $Mczr_ = $vrSVj->getInteger('value'); goto jMSmN; hCDTw: $RKwZR = array(); goto laaJG; jMSmN: $CChUV = $vrSVj->getTrimString('keywords'); goto E0rew; YiRPy: if ($CChUV) { $LBO09 = $LBO09->where($wEvc0, 'like', '%' . $CChUV . '%'); } goto qpDek; yxgXw: if (!isset($ACVUe['sort'])) { $ACVUe['sort'] = array('id', 'desc'); } goto ngADU; EBmlu: if ($Mczr_) { $LBO09 = $LBO09->where($zIeSf, $Mczr_); } goto YiRPy; laaJG: foreach ($YDsPC as $X8gVP) { $RKwZR[] = array('value' => $X8gVP[$zIeSf], 'label' => $X8gVP[$wEvc0]); } goto Posuf; qpDek: $YDsPC = $LBO09->orderBy($ACVUe['sort'][0], $ACVUe['sort'][1])->limit(10)->get(array($zIeSf, $wEvc0))->toArray(); goto hCDTw; T7nmW: } }