1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
admin_viewtabcontrol.php
См. документацию.
1<?php
8
9/*View Tab Control*/
11{
12 var $name;
13 var $tabs;
15 var $tabIndex = 0;
16
17 public function __construct($name, $tabs)
18 {
19 //array(array("DIV"=>"", "TAB"=>"", "ICON"=>, "TITLE"=>"", "ONSELECT"=>"javascript"), ...)
20 if (is_array($tabs))
21 {
22 foreach (array_keys($tabs) as $index)
23 {
24 $tabs[$index]['ONSELECT'] = (string)($tabs[$index]['ONSELECT'] ?? '');
25 }
26 }
27 $this->tabs = $tabs;
28 $this->name = $name;
29 if(isset($_REQUEST[$this->name."_active_tab"]))
30 $this->selectedTab = $_REQUEST[$this->name."_active_tab"];
31 else
32 {
33 foreach($tabs as $tab)
34 {
35 if (
36 !isset($tab["VISIBLE"])
37 || $tab["VISIBLE"]
38 )
39 {
40 $this->selectedTab = $tab["DIV"];
41 break;
42 }
43 }
44 }
45 }
46
47 function Begin()
48 {
49 echo '
50<div class="adm-detail-subtabs-block">
51';
52 $i = 0;
53 foreach($this->tabs as $tab)
54 {
55 $bSelected = ($tab["DIV"] == $this->selectedTab);
56 echo '<span class="adm-detail-subtabs'.($bSelected? " adm-detail-subtab-active":"").'" id="view_tab_'.$tab["DIV"].'" onclick="'.$this->name.'.SelectTab(\''.$tab["DIV"].'\');" title="'.$tab["TITLE"].'"'.(isset($tab["VISIBLE"]) && !$tab["VISIBLE"] ? ' style="display: none;"' : '').'>'.$tab["TAB"].'</span>'."\n";
57 $i++;
58 }
59echo '</div>';
60 }
61
62 function BeginNextTab()
63 {
64 //end previous tab
65 $this->EndTab();
66
67 if($this->tabIndex >= count($this->tabs))
68 return;
69
70 echo '
71<div id="'.$this->tabs[$this->tabIndex]["DIV"].'"'.($this->tabs[$this->tabIndex]["DIV"] <> $this->selectedTab ? ' style="display:none;"':'').'>
72 <div class="adm-detail-content-item-block-view-tab">
73 <div class="adm-detail-title-view-tab">'.$this->tabs[$this->tabIndex]["TITLE"].'</div>
74';
75 $this->tabIndex++;
76 }
77
78 function EndTab()
79 {
80 if($this->tabIndex < 1 || $this->tabIndex > count($this->tabs))
81 return;
82 echo '
83 </div>
84</div>
85';
86 }
87
88 function End()
89 {
90 $this->EndTab();
91 echo '
92<script>
93';
94 $s = "";
95 foreach($this->tabs as $tab)
96 {
97 $s .= ($s <> ""? ", ":"").
98 "{".
99 "'DIV': '".$tab["DIV"]."' ".
100 ($tab["ONSELECT"] !== '' ? ", 'ONSELECT': '".CUtil::JSEscape($tab["ONSELECT"])."'":"").
101 "}";
102 }
103 echo 'var '.$this->name.' = new BX.adminViewTabControl(['.$s.']); ';
104
105 if(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1)
106 {
107 echo 'window.'.$this->name.'.setPublicMode(true); ';
108 }
109
110 echo '</script>';
111 }
112}
__construct($name, $tabs)
Определения admin_viewtabcontrol.php:17
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
<? endif;?> window document title
Определения prolog_main_admin.php:76
$i
Определения factura.php:643
adm detail iblock types adm detail iblock list tr_SITE_ID display
Определения yandex_setup.php:388