<?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 IHqWo; UnMLE: $this->pushField($pu1ro); goto sEr_d; Jf8F_: $pu1ro->hookRendering(function (AbstractField $pu1ro, $V563N, $aDVv6) { $this->itemOperate->reset()->item($V563N)->index($aDVv6); $this->itemOperate->setField($pu1ro); if ($this->hookItemOperateRendering) { call_user_func($this->hookItemOperateRendering, $this->itemOperate); } return $this->itemOperate->render(); }); goto lznJn; IHqWo: $pu1ro = new Display('_operate', array(L('Operate'))); goto Jf8F_; lznJn: if ($this->hookItemOperateFieldBuild) { call_user_func($this->hookItemOperateFieldBuild, $pu1ro); } goto UnMLE; sEr_d: } } public function disableItemOperate() { goto Douo3; uV6FJ: $this->hookItemOperateRendering = false; goto tZTrV; Douo3: $this->canEdit = false; goto t2Ry4; fIG4w: $this->canDelete = false; goto uV6FJ; tZTrV: return $this; goto uENan; t2Ry4: $this->canShow = false; goto fIG4w; uENan: } public function hookItemOperateRendering($Yzz3F = null) { goto N17Cp; MrZcm: $this->hookItemOperateRendering = $Yzz3F; goto AVynd; N17Cp: if (null === $Yzz3F) { return $this->hookItemOperateRendering; } goto MrZcm; AVynd: return $this; goto p7AaW; p7AaW: } public function hookItemOperateFieldBuild($Yzz3F = null) { goto zVxNv; qVFVa: $this->hookItemOperateFieldBuild = $Yzz3F; goto cUBrB; cUBrB: return $this; goto w7ILL; zVxNv: if (null === $Yzz3F) { return $this->hookItemOperateFieldBuild; } goto qVFVa; w7ILL: } public function operateFixed($CoWKz) { $this->hookItemOperateFieldBuild(function (AbstractField $pu1ro) use($CoWKz) { $pu1ro->gridFixed($CoWKz); }); return $this; } }