<?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($Bodfy) { goto IvtjL; IvtjL: $this->field = new Field\Cascader($this); goto W3ASg; W3ASg: $this->field->options($Bodfy); goto QKY2h; QKY2h: return $this; goto h4XqA; h4XqA: } public function select($Bodfy) { goto Ny3B7; anEVm: $this->field->options($Bodfy); goto hCEV7; hCEV7: return $this; goto Ro9dJ; Ny3B7: $this->field = new Field\Select($this); goto anEVm; Ro9dJ: } public function selectArray($Bodfy, $nb7Km = 'id', $FHLJ4 = 'title') { $Bodfy = array_build($Bodfy, function ($pztz4, $Q0rz2) use($nb7Km, $FHLJ4) { return array($Q0rz2[$nb7Km], $Q0rz2[$FHLJ4]); }); return $this->select($Bodfy); } public function selectModel($wyCKK, $lwKEo = 'id', $vrWwY = 'name', $B1h5X = array()) { return $this->select(ModelUtil::valueMap($wyCKK, $lwKEo, $vrWwY, $B1h5X)); } public function selectLevelItems($NewRh, $nb7Km = 'id', $FHLJ4 = 'title', $cnLVC = 0) { goto GXJ9J; Aanjh: $Bodfy[0] = L('Root'); goto Je7qg; Je7qg: foreach ($NewRh as $tMyPy => $OV1o4) { if ($cnLVC > 0) { if ($OV1o4->_level > $cnLVC - 1) { continue; } } $Bodfy[$OV1o4->{$nb7Km}] = TreeUtil::itemLevelPrefix($OV1o4->_level) . $OV1o4->{$FHLJ4}; } goto Lvfjo; Lvfjo: return $this->select($Bodfy); goto lRy9c; GXJ9J: $Bodfy = array(); goto Aanjh; lRy9c: } public function selectModelTree($wyCKK, $nb7Km = 'id', $pD9GE = 'pid', $FHLJ4 = 'title', $M6Epp = 'sort', $B1h5X = array()) { goto JiRzF; ZStVr: return $this->selectLevelItems($NewRh, $nb7Km, $FHLJ4); goto mgt6X; JiRzF: $NewRh = ModelUtil::autoModel($wyCKK)->where($B1h5X)->get(array($nb7Km, $pD9GE, $FHLJ4, $M6Epp)); goto xmmsG; xmmsG: $NewRh = TreeUtil::itemsMergeLevel($NewRh, $nb7Km, $pD9GE, $M6Epp); goto ZStVr; mgt6X: } public function radio($Bodfy) { goto PmVAV; PmVAV: $this->field = new Field\Radio($this); goto HQKom; HQKom: $this->field->options($Bodfy); goto rOY1x; rOY1x: return $this; goto eqB5L; eqB5L: } public function switchRadioYesNo() { goto svooi; jj_vO: return $this; goto kNotH; svooi: $this->field = new Field\Radio($this); goto QzmX8; QzmX8: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto jj_vO; kNotH: } public function switchRadioOnOff() { goto L9rxL; Lkr4x: return $this; goto sk9uw; jwDZu: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto Lkr4x; L9rxL: $this->field = new Field\Radio($this); goto jwDZu; sk9uw: } public function switchSelectYesNo() { goto BK5fE; cyKrU: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto LVQqt; LVQqt: return $this; goto rfITO; BK5fE: $this->field = new Field\Select($this); goto cyKrU; rfITO: } public function switchSelectOnOff() { goto m1n3r; UsfMx: return $this; goto Grpxd; bMnVB: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto UsfMx; m1n3r: $this->field = new Field\Select($this); goto bMnVB; Grpxd: } }