<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Filter; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Util\TreeUtil; class Eq extends AbstractFilter { public function cascader($C87JF) { goto p3kze; p3kze: $this->field = new Field\Cascader($this); goto HeZzv; waVZA: return $this; goto uSNPS; HeZzv: $this->field->options($C87JF); goto waVZA; uSNPS: } public function select($C87JF) { goto tMrRO; ZM49N: $this->field->options($C87JF); goto wd1wT; tMrRO: $this->field = new Field\Select($this); goto ZM49N; wd1wT: return $this; goto Bu0O8; Bu0O8: } public function selectArray($C87JF, $ifxZk = 'id', $W20BA = 'title') { $C87JF = array_build($C87JF, function ($GBNIv, $VFelt) use($ifxZk, $W20BA) { return array($VFelt[$ifxZk], $VFelt[$W20BA]); }); return $this->select($C87JF); } public function selectModel($Beeb4, $bZCgI = 'id', $sb8RM = 'name', $nDJ06 = array()) { return $this->select(ModelUtil::valueMap($Beeb4, $bZCgI, $sb8RM, $nDJ06)); } public function selectLevelItems($NXm6t, $ifxZk = 'id', $W20BA = 'title', $qNbNl = 0) { goto WNMYq; WNMYq: $C87JF = array(); goto Npst1; CJ5ro: foreach ($NXm6t as $VJ5vg => $nsWl0) { if ($qNbNl > 0) { if ($nsWl0->_level > $qNbNl - 1) { continue; } } $C87JF[$nsWl0->{$ifxZk}] = TreeUtil::itemLevelPrefix($nsWl0->_level) . $nsWl0->{$W20BA}; } goto xNSKc; Npst1: $C87JF[0] = L('Root'); goto CJ5ro; xNSKc: return $this->select($C87JF); goto xyJAi; xyJAi: } public function selectModelTree($Beeb4, $ifxZk = 'id', $dbsFT = 'pid', $W20BA = 'title', $FrsLu = 'sort', $nDJ06 = array()) { goto wUWqg; wUWqg: $NXm6t = ModelUtil::autoModel($Beeb4)->where($nDJ06)->get(array($ifxZk, $dbsFT, $W20BA, $FrsLu)); goto mpTfK; AKNyo: return $this->selectLevelItems($NXm6t, $ifxZk, $W20BA); goto s5ziu; mpTfK: $NXm6t = TreeUtil::itemsMergeLevel($NXm6t, $ifxZk, $dbsFT, $FrsLu); goto AKNyo; s5ziu: } public function radio($C87JF) { goto wEDip; JFrLd: $this->field->options($C87JF); goto RFR1f; wEDip: $this->field = new Field\Radio($this); goto JFrLd; RFR1f: return $this; goto GTwxg; GTwxg: } public function switchRadioYesNo() { goto DyJPc; nJ2r8: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto zo24z; DyJPc: $this->field = new Field\Radio($this); goto nJ2r8; zo24z: return $this; goto TgfQQ; TgfQQ: } public function switchRadioOnOff() { goto zNjL3; k13lm: return $this; goto qy5cH; hZgha: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto k13lm; zNjL3: $this->field = new Field\Radio($this); goto hZgha; qy5cH: } public function switchSelectYesNo() { goto bKiyn; bKiyn: $this->field = new Field\Select($this); goto Bh3Zj; Bh3Zj: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto vzQFn; vzQFn: return $this; goto RL4bb; RL4bb: } public function switchSelectOnOff() { goto zTuww; pJMCv: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto iK2Q2; iK2Q2: return $this; goto iI6UI; zTuww: $this->field = new Field\Select($this); goto pJMCv; iI6UI: } }