<?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($vhuku) { $this->addVariables(array('server' => $vhuku)); return $this; } public function viewWithModel($zWXdn, $CDxjg = 'id', $W_PB9 = 'title') { $this->hookRendering(function (AbstractField $SQ6_6, $El_MH, $vTPD6) use($zWXdn, $CDxjg, $W_PB9) { switch ($SQ6_6->renderMode()) { case FieldRenderMode::DETAIL: case FieldRenderMode::GRID: goto B60LB; B60LB: $FT9zA = $El_MH[$SQ6_6->name()]; goto ZrBlr; HEbWb: if ($B1s6N) { $FT9zA = $B1s6N[$W_PB9]; } goto iu3lw; ZrBlr: $B1s6N = ModelUtil::get($zWXdn, array($CDxjg => $FT9zA)); goto HEbWb; iu3lw: return AutoRenderedFieldValue::make($FT9zA); goto wAAJV; wAAJV: } }); return $this; } public static function handleModel($zWXdn, $CDxjg = 'id', $W_PB9 = 'title', $Kp99R = array()) { goto lSfUr; lSfUr: if (!isset($Kp99R['sort'])) { $Kp99R['sort'] = array('id', 'desc'); } goto A0KyJ; K8fdA: return Response::generateSuccessData(array('options' => $X3Hkn)); goto NEShN; oz6f8: if ($C3P5b) { $AOBVZ = $AOBVZ->where($W_PB9, 'like', '%' . $C3P5b . '%'); } goto lX90U; lX90U: $AMtla = $AOBVZ->orderBy($Kp99R['sort'][0], $Kp99R['sort'][1])->limit(10)->get(array($CDxjg, $W_PB9))->toArray(); goto p0tGW; fFg33: if ($FT9zA) { $AOBVZ = $AOBVZ->where($CDxjg, $FT9zA); } goto oz6f8; A0KyJ: $H2Do2 = InputPackage::buildFromInput(); goto q9Hur; P4XpD: foreach ($AMtla as $B1s6N) { $X3Hkn[] = array('value' => $B1s6N[$CDxjg], 'label' => $B1s6N[$W_PB9]); } goto K8fdA; huFt2: $C3P5b = $H2Do2->getTrimString('keywords'); goto acAiE; p0tGW: $X3Hkn = array(); goto P4XpD; q9Hur: $FT9zA = $H2Do2->getInteger('value'); goto huFt2; acAiE: $AOBVZ = ModelUtil::model($zWXdn); goto fFg33; NEShN: } }