<?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($ToZUu) { parent::__construct(IdUtil::generate('LayoutTab')); $this->layoutClosure = $ToZUu; } public function postSetup() { goto sgjcb; Y1xq2: $q5NJ8 = array_map(function ($yP7h6) { return '<a href="javascript:;">' . $yP7h6 . '</a>'; }, $this->tabTitles); goto ohub9; ohub9: $q5NJ8 = json_encode(join('', $q5NJ8)); goto MI1Tb; sgjcb: $this->context->html($this->column() . '_end')->html('<div data-layout-tab="' . $this->column() . '"><div class="ub-nav-tab"></div><div>')->plain(); goto C7JhC; MI1Tb: $gnky8 = $this->column(); goto YyDVB; YyDVB: $GaVqC = "<script>\n\$(function(){\n    var tab = \$('[data-layout-tab={$gnky8}]');\n    tab.find('.ub-nav-tab').html({$q5NJ8});\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 hBDAZ; hBDAZ: $this->context->html($this->column() . '_end')->html('</div></div>' . $GaVqC)->plain(); goto VxiOI; C7JhC: call_user_func($this->layoutClosure, $this); goto Y1xq2; VxiOI: } public function tab($yP7h6, $ToZUu) { goto bxQH2; bxQH2: $this->tabTitles[] = $yP7h6; goto LeJb3; aLwGD: call_user_func($ToZUu, $this->context); goto xorQE; LeJb3: $this->context->html($this->column() . '_end')->html('<div class="ub-nav-tab-body hidden">')->plain(); goto aLwGD; xorQE: $this->context->html($this->column() . '_end')->html('</div>')->plain(); goto WJcx7; WJcx7: } public function render() { return ''; } }