<?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($smpQd) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $smpQd; } public function postSetup() { goto WvbGQ; kCeFj: $this->context->html($this->column() . '_end')->html('</div></div>' . $YnuVU)->plain(); goto t1vzG; yWAjG: $VauQt = array_map(function ($sVLvF) { return '<a href="javascript:;">' . $sVLvF . '</a>'; }, $this->tabTitles); goto wvoHm; QsyzY: $YnuVU = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$mSZnY}]');\n    tab.find('.ub-nav-tab').html({$VauQt});\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 kCeFj; AYRYH: call_user_func($this->layoutClosure, $this); goto yWAjG; d0Pi0: $mSZnY = $this->column(); goto QsyzY; wvoHm: $VauQt = json_encode(join('', $VauQt)); goto d0Pi0; WvbGQ: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto AYRYH; t1vzG: } public function tab($sVLvF, $smpQd) { goto peMB6; p5v7N: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto B9Wew; hxJuL: call_user_func($smpQd, $this->context); goto p5v7N; peMB6: $this->tabTitles[] = $sVLvF; goto qhxba; qhxba: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto hxJuL; B9Wew: } public function render() { return ''; } }