<?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($JPoXh) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $JPoXh; } public function postSetup() { goto Gtm6b; Bln4j: $hCfxr = json_encode(join('', $hCfxr)); goto Agwr6; NV3ee: $this->context->html($this->column() . '_end')->html('</div></div>' . $vso4a)->plain(); goto opDMt; Agwr6: $VDtGk = $this->column(); goto r1tiL; V4K2h: $hCfxr = array_map(function ($g3XgV) { return '<a href="javascript:;">' . $g3XgV . '</a>'; }, $this->tabTitles); goto Bln4j; QcAP8: call_user_func($this->layoutClosure, $this); goto V4K2h; Gtm6b: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto QcAP8; r1tiL: $vso4a = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$VDtGk}]');\n    tab.find('.ub-nav-tab').html({$hCfxr});\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 NV3ee; opDMt: } public function tab($g3XgV, $JPoXh) { goto F55ms; tAAyj: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto r4ZdY; r4ZdY: call_user_func($JPoXh, $this->context); goto N3yS3; N3yS3: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto ks2D2; F55ms: $this->tabTitles[] = $g3XgV; goto tAAyj; ks2D2: } public function render() { return ''; } }