forked from DavidCramer/DB-Toolkit
/
dbtoolkit_settings.php
176 lines (144 loc) · 5.94 KB
/
dbtoolkit_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
//vardump($_POST);
if(!empty($_POST['Data'])) {
$_POST = stripslashes_deep($_POST);
update_option('_dbtoolkit_defaultinterface', $_POST['Data']['Content']);
}
$defaults = get_option('_dbtoolkit_defaultinterface');
$Element['Content'] = $defaults;
?>
<form name="saveSettings" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<div id="dbt_container" class="wrap poststuff">
<?php
//<form id="ofform" enctype="multipart/form-data" action="">
?>
<input type="hidden" name="Data[Content][_FormLayout]" cols="50" rows="10" id="_FormLayout" />
<div id="header">
<div class="logo">
<?php
if(!empty($_GET['interface'])){
if(!empty($Element['_ReportDescription'])){
echo '<h2>Editing: '.$Element['_ReportDescription'].'</h2>';
}
if(!empty($Element['_ClusterTitle'])){
echo '<h2>Editing: '.$Element['_ClusterTitle'].'</h2>';
}
}else{
?>
<h2>Default Settings for New interfaces</h2>
<?php
}
?>
</div>
<div class="clear"></div>
</div>
<div id="main">
<div id="dbt-nav">
<ul>
<?php
// Dynamic Listing
$Tabs = array(
'General Settings'=>'viewsettings.php',
//'Chart Setup'=>'chartlayout.php'
);
//Load Configs for extensions
$ext = array();
// View Processors
$viewProcessors = list_files(DB_TOOLKIT.'data_report/processors');
foreach($viewProcessors as $processor){
if(basename($processor) == 'conf.php'){
include($processor);
if(!empty($ConfigFile)){
if(file_exists('processors/'.basename(dirname($processor)).'/'.$ConfigFile)){
$ext[$ViewTitle] = 'processors/'.basename(dirname($processor)).'/'.$ConfigFile;
}
}
unset($ConfigFile);
}
}
// Form Processors
$formProcessors = list_files(DB_TOOLKIT.'data_report/processors');
foreach($formProcessors as $processor){
if(basename($processor) == 'conf.php'){
include($processor);
if(!empty($ConfigFile)){
if(file_exists('processors/'.basename(dirname($processor)).'/'.$ConfigFile)){
$ext[$ViewTitle] = 'processors/'.basename(dirname($processor)).'/'.$ConfigFile;
}
}
unset($ConfigFile);
}
}
ksort($ext);
$Tabs = array_merge($Tabs, $ext);
$tabIndex = 1;
foreach($Tabs as $Title=>$File){
$Class = '';
if(!empty($_GET['ctb'])){
if($_GET['ctb'] == $tabIndex){
$Class = 'current';
}
}else{
if($tabIndex == 1){
$Class= 'current';
}
}
echo '<li class="'.$Class.'">';
echo '<a href="#dbt-option-'.$tabIndex++.'" title="'.$Title.'">'.$Title.'</a>';
echo '</li>';
}
?>
</ul>
</div>
<div id="content">
<?php
// Option Tab
$tabIndex = 1;
foreach($Tabs as $Title=>$File){
$view = 'none';
if(!empty($_GET['ctb'])){
if($_GET['ctb'] == $tabIndex){
$view = 'block';
}
}else{
if($tabIndex == 1){
$view = 'block';
}
}
echo '<div id="dbt-option-'.$tabIndex.'" class="group" style="display: '.$view.';">';
include(WP_PLUGIN_DIR.'/db-toolkit/data_report/'.$File);
echo '</div>';
$tabIndex++;
}
?>
</div>
<div class="clear"></div>
</div>
<div class="save_bar_top">
<span class="submit-footer-reset">
<input type="button" onclick="return window.location='admin.php?page=dbt_builder';" class="button submit-button reset-button" value="Close" name="close">
<?php echo dais_standardSetupbuttons($Element); ?>
</span>
</div>
<?php
//</form>
?>
<div style="clear:both;"></div>
</div>
</form>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#dbt-nav li a').click(function(){
jQuery('#dbt-nav li').removeClass('current');
jQuery('.group').hide();
jQuery(''+jQuery(this).attr('href')+'').show();
jQuery(this).parent().addClass('current');
//alert(jQuery(this).attr('href'));
return false;
});
jQuery('#dbt_container .help').click(function(){
jQuery(''+jQuery(this).attr('href')+'').toggle();
return false;
})
});
</script>