<?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($ZNmAK) { goto zFHnI; zFHnI: $this->field = new Field\Cascader($this); goto bYAv8; bYAv8: $this->field->options($ZNmAK); goto qf6ev; qf6ev: return $this; goto eipp1; eipp1: } public function select($ZNmAK) { goto V7Spq; OjZlZ: return $this; goto ADo5w; V7Spq: $this->field = new Field\Select($this); goto l9nI2; l9nI2: $this->field->options($ZNmAK); goto OjZlZ; ADo5w: } public function selectArray($ZNmAK, $KgjGp = 'id', $Xm9M0 = 'title') { $ZNmAK = array_build($ZNmAK, function ($plrwN, $uTz0e) use($KgjGp, $Xm9M0) { return array($uTz0e[$KgjGp], $uTz0e[$Xm9M0]); }); return $this->select($ZNmAK); } public function selectModel($oAD_e, $aKi50 = 'id', $TcL6O = 'name', $AMnOB = array()) { return $this->select(ModelUtil::valueMap($oAD_e, $aKi50, $TcL6O, $AMnOB)); } public function selectLevelItems($aSut7, $KgjGp = 'id', $Xm9M0 = 'title', $OSZqq = 0) { goto X4QOW; Ltb7R: $ZNmAK[0] = L('Root'); goto c40ug; X4QOW: $ZNmAK = array(); goto Ltb7R; x280V: return $this->select($ZNmAK); goto Gp8uE; c40ug: foreach ($aSut7 as $UCcmA => $ZpLX1) { if ($OSZqq > 0) { if ($ZpLX1->_level > $OSZqq - 1) { continue; } } $ZNmAK[$ZpLX1->{$KgjGp}] = TreeUtil::itemLevelPrefix($ZpLX1->_level) . $ZpLX1->{$Xm9M0}; } goto x280V; Gp8uE: } public function selectModelTree($oAD_e, $KgjGp = 'id', $gFVW4 = 'pid', $Xm9M0 = 'title', $uHXOC = 'sort', $AMnOB = array()) { goto Mba3i; wn4TE: $aSut7 = TreeUtil::itemsMergeLevel($aSut7, $KgjGp, $gFVW4, $uHXOC); goto rjpMW; rjpMW: return $this->selectLevelItems($aSut7, $KgjGp, $Xm9M0); goto QrhE_; Mba3i: $aSut7 = ModelUtil::autoModel($oAD_e)->where($AMnOB)->get(array($KgjGp, $gFVW4, $Xm9M0, $uHXOC)); goto wn4TE; QrhE_: } public function radio($ZNmAK) { goto WW2vd; WW2vd: $this->field = new Field\Radio($this); goto GkIjD; J8Woj: return $this; goto Xbdof; GkIjD: $this->field->options($ZNmAK); goto J8Woj; Xbdof: } public function switchRadioYesNo() { goto WT0GG; WT0GG: $this->field = new Field\Radio($this); goto g2UxT; g2UxT: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto pKuFg; pKuFg: return $this; goto q18ea; q18ea: } public function switchRadioOnOff() { goto TDQqP; fqQYv: return $this; goto OUWMM; TDQqP: $this->field = new Field\Radio($this); goto OnBiS; OnBiS: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto fqQYv; OUWMM: } public function switchSelectYesNo() { goto NNhrh; r03u1: return $this; goto kidGR; I5I3w: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto r03u1; NNhrh: $this->field = new Field\Select($this); goto I5I3w; kidGR: } public function switchSelectOnOff() { goto QIRnx; ml4xT: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto UKT5e; UKT5e: return $this; goto QDYPM; QIRnx: $this->field = new Field\Select($this); goto ml4xT; QDYPM: } }