<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Displayer; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\View; use ModStart\Field\AbstractField; use ModStart\Widget\TextAction; use ModStart\Widget\TextLink; class ItemOperate extends AbstractDisplayer { protected $field; protected $item; protected $index; protected $canShow; protected $canEdit; protected $canDelete; protected $canSort; protected $canCopy; protected $operates = array(); protected $onlyOperate = null; protected $prependOperates = array(); protected $appendOperates = array(); protected $fluentAttributes = array('item', 'index', 'canShow', 'canEdit', 'canDelete', 'canSort', 'canCopy'); public function reset() { goto I315V; Ur4iD: $this->canCopy = $this->grid->canCopy() && $this->grid->canAdd(); goto JWGcv; uZEHJ: return $this; goto u4zhC; swJDR: $this->canDelete = $this->grid->canDelete(); goto lCBJA; JWGcv: $this->resetOperates(); goto uZEHJ; lCBJA: $this->canSort = $this->grid->canSort(); goto Ur4iD; iJCuh: $this->canShow = $this->grid->canShow(); goto UqXDv; fAAOD: $this->index = null; goto iJCuh; UqXDv: $this->canEdit = $this->grid->canEdit(); goto swJDR; I315V: $this->item = null; goto fAAOD; u4zhC: } public function setField($SQ6_6) { $this->field = $SQ6_6; } public function getField() { return $this->field; } public function resetOperates() { goto FGQNl; sAWaN: $this->prependOperates = array(); goto Ahi6e; Ahi6e: $this->appendOperates = array(); goto U707f; FGQNl: $this->onlyOperate = null; goto sAWaN; U707f: } public function only($fxnpU) { $this->onlyOperate = $fxnpU; return $this; } public function push($fxnpU) { $this->appendOperates[] = $fxnpU; return $this; } public function prepend($fxnpU) { if (is_array($fxnpU)) { $this->prependOperates = array_merge($fxnpU, $this->prependOperates); } else { $this->prependOperates[] = $fxnpU; } } public function render() { goto zcKFX; zcKFX: if (null !== $this->onlyOperate) { return $this->onlyOperate; } goto xMDkV; IySD9: if ($this->canDelete() && $this->grid->urlDelete()) { $this->operates[] = TextAction::danger(L('Delete'), 'data-delete'); } goto Cc3mB; JTyug: $this->operates = array_merge($this->operates, $this->prependOperates); goto hZlFg; EwabX: if ($this->canEdit() && $this->grid->urlEdit()) { goto Z9JXS; xcSVj: if (empty($SsRVK)) { $SsRVK = L('Edit'); } goto C8GYD; C8GYD: if ($this->grid->editBlankPage()) { $this->operates[] = TextLink::primary($SsRVK, $this->grid->urlEdit() . '?_id=' . $this->item->{$this->grid->getRepositoryKeyName()}, View::shared('_isTab') ? 'data-tab-open' : ''); } else { $this->operates[] = TextAction::primary($SsRVK, 'data-edit'); } goto pSWnM; Z9JXS: $SsRVK = $this->grid->textEdit(); goto xcSVj; pSWnM: } goto IySD9; fspWi: if ($this->canShow() && $this->grid->urlShow()) { $this->operates[] = TextAction::primary(L('Show'), 'data-show'); } goto EwabX; lEpN1: $this->operates = array_merge($this->operates, $this->appendOperates); goto HVAAc; HVAAc: return join('', $this->operates); goto wZPTT; xMDkV: $this->operates = array(); goto JTyug; Cc3mB: if ($this->canCopy()) { $this->operates[] = TextAction::muted(L('Copy'), 'data-add-button data-add-copy-button'); } goto lEpN1; hZlFg: if ($this->canSort() && $this->grid->urlSort()) { goto jR5QH; jR5QH: $this->operates[] = TextAction::primary('<i class="iconfont icon-top"></i>', 'data-sort="top"'); goto TARzx; TARzx: $this->operates[] = TextAction::primary('<i class="iconfont icon-direction-up"></i>', 'data-sort="up"'); goto BBNKY; X45u5: $this->operates[] = TextAction::primary('<i class="iconfont icon-bottom"></i>', 'data-sort="bottom"'); goto sXhHg; BBNKY: $this->operates[] = TextAction::primary('<i class="iconfont icon-direction-down"></i>', 'data-sort="down"'); goto X45u5; sXhHg: } goto fspWi; wZPTT: } }