<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Layout; use ModStart\Core\Util\IdUtil; use ModStart\Field\AbstractField; class LayoutTab extends AbstractField { protected $isLayoutField = true; private $layoutClosure = null; private $tabTitles = array(); public function __construct($UmXKN) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $UmXKN; } public function postSetup() { goto uTkSM; z7qAb: $Bejmk = array_map(function ($znmpZ) { return '<a href="javascript:;">' . $znmpZ . '</a>'; }, $this->tabTitles); goto dmfUQ; uTkSM: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto WN_EJ; qlNwF: $this->context->html($this->column() . '_end')->html('</div></div>' . $U67O6)->plain(); goto XUgX5; E16SJ: $xiZoD = $this->column(); goto Ahvuk; dmfUQ: $Bejmk = json_encode(join('', $Bejmk)); goto E16SJ; WN_EJ: call_user_func($this->layoutClosure, $this); goto z7qAb; Ahvuk: $U67O6 = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$xiZoD}]');\n    tab.find('.ub-nav-tab').html({$Bejmk});\n    var tabAs = tab.find('.ub-nav-tab > a');\n    var active = function(index){\n        tabAs.removeClass('active').eq(index).addClass('active');\n        tab.find('.ub-nav-tab-body').addClass('hidden').eq(index).removeClass('hidden');\n    };\n    active(0);\n    tab.on('click','a',function(){\n        active(tabAs.index(this));\n    });\n});\n</script>"; goto qlNwF; XUgX5: } public function tab($znmpZ, $UmXKN) { goto h3gLh; yFLaa: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto yWym3; h3gLh: $this->tabTitles[] = $znmpZ; goto TiOdU; TiOdU: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto Hi3n8; Hi3n8: call_user_func($UmXKN, $this->context); goto yFLaa; yWym3: } public function render() { return ''; } }