<?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 f1wS7; n50QS: $this->canShow = $this->grid->canShow(); goto EjObg; Kdufe: $this->index = null; goto n50QS; v2EPd: $this->canSort = $this->grid->canSort(); goto iFTO2; GN33G: return $this; goto Fj952; QyCZe: $this->canDelete = $this->grid->canDelete(); goto v2EPd; EjObg: $this->canEdit = $this->grid->canEdit(); goto QyCZe; f1wS7: $this->item = null; goto Kdufe; ZX5fN: $this->resetOperates(); goto GN33G; iFTO2: $this->canCopy = $this->grid->canCopy() && $this->grid->canAdd(); goto ZX5fN; Fj952: } public function setField($Ldet7) { $this->field = $Ldet7; } public function getField() { return $this->field; } public function resetOperates() { goto kJZ2W; RJXFJ: $this->appendOperates = array(); goto yzaV2; Z3xa5: $this->prependOperates = array(); goto RJXFJ; kJZ2W: $this->onlyOperate = null; goto Z3xa5; yzaV2: } public function only($MQLFE) { $this->onlyOperate = $MQLFE; return $this; } public function push($MQLFE) { $this->appendOperates[] = $MQLFE; return $this; } public function prepend($MQLFE) { if (is_array($MQLFE)) { $this->prependOperates = array_merge($MQLFE, $this->prependOperates); } else { $this->prependOperates[] = $MQLFE; } } public function render() { goto JddCo; V5_b2: $this->operates = array_merge($this->operates, $this->appendOperates); goto CC0Fs; Q7OIF: if ($this->canSort() && $this->grid->urlSort()) { goto rAhk9; rIxuj: $this->operates[] = TextAction::primary('<i class="iconfont icon-bottom"></i>', 'data-sort="bottom"'); goto zEUig; TQ_8G: $this->operates[] = TextAction::primary('<i class="iconfont icon-direction-up"></i>', 'data-sort="up"'); goto MrCsG; MrCsG: $this->operates[] = TextAction::primary('<i class="iconfont icon-direction-down"></i>', 'data-sort="down"'); goto rIxuj; rAhk9: $this->operates[] = TextAction::primary('<i class="iconfont icon-top"></i>', 'data-sort="top"'); goto TQ_8G; zEUig: } goto bH2Qc; JddCo: if (null !== $this->onlyOperate) { return $this->onlyOperate; } goto QwJw0; CC0Fs: return join('', $this->operates); goto WTvga; QwJw0: $this->operates = array(); goto rLnVm; bH2Qc: if ($this->canShow() && $this->grid->urlShow()) { $this->operates[] = TextAction::primary(L('Show'), 'data-show'); } goto mM9Vl; pVz0A: if ($this->canDelete() && $this->grid->urlDelete()) { $this->operates[] = TextAction::danger(L('Delete'), 'data-delete'); } goto MG3wN; rLnVm: $this->operates = array_merge($this->operates, $this->prependOperates); goto Q7OIF; MG3wN: if ($this->canCopy()) { $this->operates[] = TextAction::muted(L('Copy'), 'data-add-button data-add-copy-button'); } goto V5_b2; mM9Vl: if ($this->canEdit() && $this->grid->urlEdit()) { goto aThGR; qM9sa: if ($this->grid->editBlankPage()) { $this->operates[] = TextLink::primary($wlGfh, $this->grid->urlEdit() . '?_id=' . $this->item->{$this->grid->getRepositoryKeyName()}, modstart_admin_is_tab() ? 'data-tab-open data-refresh-grid-on-close' : ''); } else { $this->operates[] = TextAction::primary($wlGfh, 'data-edit'); } goto VPdqb; Y5PlO: if (empty($wlGfh)) { $wlGfh = L('Edit'); } goto qM9sa; aThGR: $wlGfh = $this->grid->textEdit(); goto Y5PlO; VPdqb: } goto pVz0A; WTvga: } }