<?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($oRPSk) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $oRPSk; } public function postSetup() { goto hi21F; Xq6xa: $JJepM = $this->column(); goto iHDda; X5NZ2: $Zbk3F = json_encode(join('', $Zbk3F)); goto Xq6xa; iHDda: $w4Ieb = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$JJepM}]');\n    tab.find('.ub-nav-tab').html({$Zbk3F});\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 Z4Q0f; hi21F: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto lqDdy; Z4Q0f: $this->context->html($this->column() . '_end')->html('</div></div>' . $w4Ieb)->plain(); goto vUqxZ; yB6Lp: $Zbk3F = array_map(function ($GjNrA) { return '<a href="javascript:;">' . $GjNrA . '</a>'; }, $this->tabTitles); goto X5NZ2; lqDdy: call_user_func($this->layoutClosure, $this); goto yB6Lp; vUqxZ: } public function tab($GjNrA, $oRPSk) { goto opVt_; opVt_: $this->tabTitles[] = $GjNrA; goto j_bqk; t46ZI: call_user_func($oRPSk, $this->context); goto LiB2x; j_bqk: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto t46ZI; LiB2x: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto DEEBK; DEEBK: } public function render() { return ''; } }