addtab.php
36 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments - Libraries |
| 4 | * @subpackage html.bootstrap |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | $selector = empty($displayData['selector']) ? '' : $displayData['selector']; |
| 15 | $id = empty($displayData['id']) ? '' : $displayData['id']; |
| 16 | $active = empty($displayData['active']) ? '' : $displayData['active']; |
| 17 | $title = empty($displayData['title']) ? '' : $displayData['title']; |
| 18 | |
| 19 | $li = '<li class="' . trim($active) . '"><a href="#' . $id . '" data-toggle="tab">' . addslashes($title) . '</a></li>'; |
| 20 | |
| 21 | ?> |
| 22 | |
| 23 | <script> |
| 24 | <?php |
| 25 | echo |
| 26 | <<<JS |
| 27 | jQuery('#{$selector}Tabs').append('{$li}').children().last().on('click', function() { |
| 28 | {$selector}BootstrapTabSetChanged('{$id}'); |
| 29 | }); |
| 30 | JS |
| 31 | ; |
| 32 | ?> |
| 33 | </script> |
| 34 | |
| 35 | <div id="<?php echo $id; ?>" class="tab-pane<?php echo $active; ?>" <?php echo ($active ? '' : 'style="display:none;"'); ?>> |
| 36 |