<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Concerns; use ModStart\Field\AbstractField; use ModStart\Field\Display; use ModStart\Grid\Displayer\ItemOperate; use ModStart\Support\Concern\HasSetting; trait HasItemOperate { private $itemOperate; private $hookItemOperateRendering; private $hookItemOperateFieldBuild; private function setupItemOperate() { $this->itemOperate = new ItemOperate($this); } private function prepareItemOperateField() { if ($this->canEdit || $this->canShow || $this->canDelete || $this->hookItemOperateRendering) { goto vznBJ; u_2DZ: if ($this->hookItemOperateFieldBuild) { call_user_func($this->hookItemOperateFieldBuild, $SQ6_6); } goto xy13D; SEV2M: $SQ6_6->hookRendering(function (AbstractField $SQ6_6, $El_MH, $vTPD6) { $this->itemOperate->reset()->item($El_MH)->index($vTPD6); $this->itemOperate->setField($SQ6_6); if ($this->hookItemOperateRendering) { call_user_func($this->hookItemOperateRendering, $this->itemOperate); } return $this->itemOperate->render(); }); goto u_2DZ; xy13D: $this->pushField($SQ6_6); goto dH21O; vznBJ: $SQ6_6 = new Display('_operate', array(L('Operate'))); goto SEV2M; dH21O: } } public function disableItemOperate() { goto mbP3H; nPS9N: $this->hookItemOperateRendering = false; goto YtUXi; CntbU: $this->canDelete = false; goto nPS9N; s5gWR: $this->canShow = false; goto CntbU; YtUXi: return $this; goto mWov9; mbP3H: $this->canEdit = false; goto s5gWR; mWov9: } public function hookItemOperateRendering($r1VBm = null) { goto lMXpD; lMXpD: if (null === $r1VBm) { return $this->hookItemOperateRendering; } goto DfsYL; DfsYL: $this->hookItemOperateRendering = $r1VBm; goto NFsqd; NFsqd: return $this; goto k94gp; k94gp: } public function hookItemOperateFieldBuild($r1VBm = null) { goto GAoZF; RPfSK: return $this; goto P1aBH; mmFpJ: $this->hookItemOperateFieldBuild = $r1VBm; goto RPfSK; GAoZF: if (null === $r1VBm) { return $this->hookItemOperateFieldBuild; } goto mmFpJ; P1aBH: } public function operateFixed($SlOkg) { $this->hookItemOperateFieldBuild(function (AbstractField $SQ6_6) use($SlOkg) { $SQ6_6->gridFixed($SlOkg); }); return $this; } }