<?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 HvK4t; usL9f: $Ldet7->hookRendering(function (AbstractField $Ldet7, $P1uVJ, $C6OV7) { $this->itemOperate->reset()->item($P1uVJ)->index($C6OV7); $this->itemOperate->setField($Ldet7); if ($this->hookItemOperateRendering) { call_user_func($this->hookItemOperateRendering, $this->itemOperate); } return $this->itemOperate->render(); }); goto n8nRs; n8nRs: if ($this->hookItemOperateFieldBuild) { call_user_func($this->hookItemOperateFieldBuild, $Ldet7); } goto tfjva; HvK4t: $Ldet7 = new Display('_operate', array(L('Operate'))); goto usL9f; tfjva: $this->pushField($Ldet7); goto t2Mi6; t2Mi6: } } public function disableItemOperate() { goto SIfUL; w9zxQ: $this->hookItemOperateRendering = false; goto TQsfB; uf3QP: $this->canShow = false; goto NpLck; NpLck: $this->canDelete = false; goto w9zxQ; TQsfB: return $this; goto yNsn1; SIfUL: $this->canEdit = false; goto uf3QP; yNsn1: } public function hookItemOperateRendering($liNDm = null) { goto amRg4; amRg4: if (null === $liNDm) { return $this->hookItemOperateRendering; } goto hCj7L; Udx_0: return $this; goto cUEW0; hCj7L: $this->hookItemOperateRendering = $liNDm; goto Udx_0; cUEW0: } public function hookItemOperateFieldBuild($liNDm = null) { goto antRn; xKCy3: $this->hookItemOperateFieldBuild = $liNDm; goto tgxwF; antRn: if (null === $liNDm) { return $this->hookItemOperateFieldBuild; } goto xKCy3; tgxwF: return $this; goto IQauO; IQauO: } public function operateFixed($XSW8w) { $this->hookItemOperateFieldBuild(function (AbstractField $Ldet7) use($XSW8w) { $Ldet7->gridFixed($XSW8w); }); return $this; } }