<?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($Tpa5t) { goto u3aTj; m8tdu: return $this; goto sPhYe; u3aTj: $this->field = new Field\Cascader($this); goto V0DjH; V0DjH: $this->field->options($Tpa5t); goto m8tdu; sPhYe: } public function select($Tpa5t) { goto avsrP; eMTZ0: return $this; goto CVI8x; HKBpr: $this->field->options($Tpa5t); goto eMTZ0; avsrP: $this->field = new Field\Select($this); goto HKBpr; CVI8x: } public function selectArray($Tpa5t, $Elwu5 = 'id', $ti9Nw = 'title') { $Tpa5t = array_build($Tpa5t, function ($Fkd1C, $pk5fc) use($Elwu5, $ti9Nw) { return array($pk5fc[$Elwu5], $pk5fc[$ti9Nw]); }); return $this->select($Tpa5t); } public function selectModel($tkusQ, $CnFib = 'id', $paeUa = 'name', $JRjnb = array()) { return $this->select(ModelUtil::valueMap($tkusQ, $CnFib, $paeUa, $JRjnb)); } public function selectLevelItems($dhsbx, $Elwu5 = 'id', $ti9Nw = 'title', $XboOM = 0) { goto zpvpH; mVMdl: foreach ($dhsbx as $Xn_Rr => $yFnpO) { if ($XboOM > 0) { if ($yFnpO->_level > $XboOM - 1) { continue; } } $Tpa5t[$yFnpO->{$Elwu5}] = TreeUtil::itemLevelPrefix($yFnpO->_level) . $yFnpO->{$ti9Nw}; } goto EFFA1; zpvpH: $Tpa5t = array(); goto nYa02; EFFA1: return $this->select($Tpa5t); goto OM5o5; nYa02: $Tpa5t[0] = L('Root'); goto mVMdl; OM5o5: } public function selectModelTree($tkusQ, $Elwu5 = 'id', $RyxSz = 'pid', $ti9Nw = 'title', $oht67 = 'sort', $JRjnb = array()) { goto tmN2U; b1xga: return $this->selectLevelItems($dhsbx, $Elwu5, $ti9Nw); goto WoC_F; RG3Fr: $dhsbx = TreeUtil::itemsMergeLevel($dhsbx, $Elwu5, $RyxSz, $oht67); goto b1xga; tmN2U: $dhsbx = ModelUtil::autoModel($tkusQ)->where($JRjnb)->get(array($Elwu5, $RyxSz, $ti9Nw, $oht67)); goto RG3Fr; WoC_F: } public function radio($Tpa5t) { goto AyZXJ; t4Bty: return $this; goto BZc8n; MUguS: $this->field->options($Tpa5t); goto t4Bty; AyZXJ: $this->field = new Field\Radio($this); goto MUguS; BZc8n: } public function switchRadioYesNo() { goto OL0Ko; OL0Ko: $this->field = new Field\Radio($this); goto gnpn3; gnpn3: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto EUem4; EUem4: return $this; goto AaKc3; AaKc3: } public function switchRadioOnOff() { goto LowzI; ItIg3: return $this; goto opTNf; LowzI: $this->field = new Field\Radio($this); goto i2sIp; i2sIp: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto ItIg3; opTNf: } public function switchSelectYesNo() { goto FtK6F; wIA_4: return $this; goto u3sRi; rdhf5: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto wIA_4; FtK6F: $this->field = new Field\Select($this); goto rdhf5; u3sRi: } public function switchSelectOnOff() { goto n0b1F; bL1FX: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto riRRp; riRRp: return $this; goto dWpc2; n0b1F: $this->field = new Field\Select($this); goto bL1FX; dWpc2: } }