<?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 DyF4L; DyF4L: $E8QRJ = new Display('_operate', array(L('Operate'))); goto KTVvx; KTVvx: $E8QRJ->hookRendering(function (AbstractField $E8QRJ, $OV1o4, $xlsSz) { $this->itemOperate->reset()->item($OV1o4)->index($xlsSz); $this->itemOperate->setField($E8QRJ); if ($this->hookItemOperateRendering) { call_user_func($this->hookItemOperateRendering, $this->itemOperate); } return $this->itemOperate->render(); }); goto yiaZP; nX0Ji: $this->pushField($E8QRJ); goto VNw_A; yiaZP: if ($this->hookItemOperateFieldBuild) { call_user_func($this->hookItemOperateFieldBuild, $E8QRJ); } goto nX0Ji; VNw_A: } } public function disableItemOperate() { goto sZ8m4; xINJB: $this->canDelete = false; goto ixRCl; ZeUYV: return $this; goto gEoEP; hem2i: $this->canShow = false; goto xINJB; ixRCl: $this->hookItemOperateRendering = false; goto ZeUYV; sZ8m4: $this->canEdit = false; goto hem2i; gEoEP: } public function hookItemOperateRendering($uTSeU = null) { goto Mytec; DD_SY: $this->hookItemOperateRendering = $uTSeU; goto K2Y1t; Mytec: if (null === $uTSeU) { return $this->hookItemOperateRendering; } goto DD_SY; K2Y1t: return $this; goto cV9B0; cV9B0: } public function hookItemOperateFieldBuild($uTSeU = null) { goto BxkPO; uf0Mr: $this->hookItemOperateFieldBuild = $uTSeU; goto zHCo6; zHCo6: return $this; goto f8qMA; BxkPO: if (null === $uTSeU) { return $this->hookItemOperateFieldBuild; } goto uf0Mr; f8qMA: } public function operateFixed($BRxLF) { $this->hookItemOperateFieldBuild(function (AbstractField $E8QRJ) use($BRxLF) { $E8QRJ->gridFixed($BRxLF); }); return $this; } }