<?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 Lijmu; r6Knz: if ($this->hookItemOperateFieldBuild) { call_user_func($this->hookItemOperateFieldBuild, $acdQI); } goto GLDaA; jNoEi: $acdQI->hookRendering(function (AbstractField $acdQI, $Xvngd, $K_IJ6) { $this->itemOperate->reset()->item($Xvngd)->index($K_IJ6); $this->itemOperate->setField($acdQI); if ($this->hookItemOperateRendering) { call_user_func($this->hookItemOperateRendering, $this->itemOperate); } return $this->itemOperate->render(); }); goto r6Knz; Lijmu: $acdQI = new Display('_operate', array(L('Operate'))); goto jNoEi; GLDaA: $this->pushField($acdQI); goto fwRKQ; fwRKQ: } } public function disableItemOperate() { goto RHg67; OpQ4j: $this->hookItemOperateRendering = false; goto ELy5n; RHg67: $this->canEdit = false; goto yXNt8; LJmJa: $this->canDelete = false; goto OpQ4j; ELy5n: return $this; goto RLyaa; yXNt8: $this->canShow = false; goto LJmJa; RLyaa: } public function hookItemOperateRendering($SO11l = null) { goto faKUD; faKUD: if (null === $SO11l) { return $this->hookItemOperateRendering; } goto FT4f_; YtpzZ: return $this; goto tYB2X; FT4f_: $this->hookItemOperateRendering = $SO11l; goto YtpzZ; tYB2X: } public function hookItemOperateFieldBuild($SO11l = null) { goto TSzvb; Y3KEg: return $this; goto ILZ9K; m8PFl: $this->hookItemOperateFieldBuild = $SO11l; goto Y3KEg; TSzvb: if (null === $SO11l) { return $this->hookItemOperateFieldBuild; } goto m8PFl; ILZ9K: } public function operateFixed($KvTJ9) { $this->hookItemOperateFieldBuild(function (AbstractField $acdQI) use($KvTJ9) { $acdQI->gridFixed($KvTJ9); }); return $this; } }