<?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($ofcu0) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $ofcu0; } public function postSetup() { goto X9wMy; X9wMy: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto FeKsL; EwHXp: $BDska = array_map(function ($IJdfw) { return '<a href="javascript:;">' . $IJdfw . '</a>'; }, $this->tabTitles); goto rzsRA; W8n25: $this->context->html($this->column() . '_end')->html('</div></div>' . $kWBBM)->plain(); goto xR1OI; rzsRA: $BDska = json_encode(join('', $BDska)); goto kWGGe; kWGGe: $XrXh2 = $this->column(); goto IooNl; FeKsL: call_user_func($this->layoutClosure, $this); goto EwHXp; IooNl: $kWBBM = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$XrXh2}]');\n    tab.find('.ub-nav-tab').html({$BDska});\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 W8n25; xR1OI: } public function tab($IJdfw, $ofcu0) { goto NO1tk; Tb3PW: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto FSekl; gqQAk: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto HbpZU; NO1tk: $this->tabTitles[] = $IJdfw; goto Tb3PW; FSekl: call_user_func($ofcu0, $this->context); goto gqQAk; HbpZU: } public function render() { return ''; } }