<?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($RKwZR) { goto RhQle; W_InG: $this->field->options($RKwZR); goto WNT_v; RhQle: $this->field = new Field\Cascader($this); goto W_InG; WNT_v: return $this; goto hBWHo; hBWHo: } public function select($RKwZR) { goto gUC7R; gUC7R: $this->field = new Field\Select($this); goto XwL6W; G06Et: return $this; goto TS0v3; XwL6W: $this->field->options($RKwZR); goto G06Et; TS0v3: } public function selectArray($RKwZR, $McuFj = 'id', $Xh0Br = 'title') { $RKwZR = array_build($RKwZR, function ($B34tD, $Xz28r) use($McuFj, $Xh0Br) { return array($Xz28r[$McuFj], $Xz28r[$Xh0Br]); }); return $this->select($RKwZR); } public function selectModel($AD05J, $eAE99 = 'id', $Qduwq = 'name', $Svako = array()) { return $this->select(ModelUtil::valueMap($AD05J, $eAE99, $Qduwq, $Svako)); } public function selectLevelItems($BA7mb, $McuFj = 'id', $Xh0Br = 'title', $xXDd8 = 0) { goto D4y39; DuW4v: foreach ($BA7mb as $kM8qX => $Esk0p) { if ($xXDd8 > 0) { if ($Esk0p->_level > $xXDd8 - 1) { continue; } } $RKwZR[$Esk0p->{$McuFj}] = TreeUtil::itemLevelPrefix($Esk0p->_level) . $Esk0p->{$Xh0Br}; } goto fGXIp; D4y39: $RKwZR = array(); goto cWvwW; fGXIp: return $this->select($RKwZR); goto T7r7X; cWvwW: $RKwZR[0] = L('Root'); goto DuW4v; T7r7X: } public function selectModelTree($AD05J, $McuFj = 'id', $obDAG = 'pid', $Xh0Br = 'title', $lRvVf = 'sort', $Svako = array()) { goto iKwG_; I_4oC: $BA7mb = TreeUtil::itemsMergeLevel($BA7mb, $McuFj, $obDAG, $lRvVf); goto uh9wQ; iKwG_: $BA7mb = ModelUtil::autoModel($AD05J)->where($Svako)->get(array($McuFj, $obDAG, $Xh0Br, $lRvVf)); goto I_4oC; uh9wQ: return $this->selectLevelItems($BA7mb, $McuFj, $Xh0Br); goto G95PF; G95PF: } public function radio($RKwZR) { goto fZkhP; U5N_f: return $this; goto b6Ytg; fZkhP: $this->field = new Field\Radio($this); goto vzfGS; vzfGS: $this->field->options($RKwZR); goto U5N_f; b6Ytg: } public function switchRadioYesNo() { goto cyAPS; sghcw: return $this; goto So31l; gaded: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto sghcw; cyAPS: $this->field = new Field\Radio($this); goto gaded; So31l: } public function switchRadioOnOff() { goto KT7oy; KT7oy: $this->field = new Field\Radio($this); goto K5wRc; K5wRc: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto DRfF_; DRfF_: return $this; goto kgxwv; kgxwv: } public function switchSelectYesNo() { goto mqAO6; DaEFy: return $this; goto B_AVm; xXSVU: $this->field->options(array('0' => L('No'), '1' => L('Yes'))); goto DaEFy; mqAO6: $this->field = new Field\Select($this); goto xXSVU; B_AVm: } public function switchSelectOnOff() { goto cesba; M9Kme: $this->field->options(array('0' => L('Off'), '1' => L('On'))); goto b9voY; cesba: $this->field = new Field\Select($this); goto M9Kme; b9voY: return $this; goto F6_6T; F6_6T: } }