-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryQuery_admin.php
More file actions
171 lines (158 loc) · 8.14 KB
/
QueryQuery_admin.php
File metadata and controls
171 lines (158 loc) · 8.14 KB
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
<?php
/*-----------------------------------------------------------------------------------------------------//
Query Query Admin Page(s) Content
-------------------------------------------------------------------------------------------------------*/
// get QueryQuery Admin Options
include_once('QueryQuery_options.php');
?>
<div class="wrap">
<h2 class="nav-tab-wrapper">
<a href="<?php if(isset($_GET["page"])){ echo admin_url("admin.php")."?page=".$_GET["page"]."#"; };?>" class="nav-tab <?php if($_GET["action"]== ""){ echo "nav-tab-active";}; ?> ">
<?php _e( 'Defaults' ); ?>
</a><a href="<?php if(isset($_GET["page"])){ echo admin_url("admin.php")."?page=".$_GET["page"]."&action=examples";}; ?>" class="nav-tab <?php if($_GET["action"]=="examples"){ echo "nav-tab-active";}; ?>">
<?php _e( 'Examples' ); ?>
</a>
</h2>
<?php
/*-----------------------------------------------------------------------------------------------------//
//DEFAULT Tab
-------------------------------------------------------------------------------------------------------*/
if(isset($_GET["action"])){$tabaction=$_GET["action"];}else{$tabaction="default";};
if ($tabaction =="default"){
?>
<div id="menu-tab-default" <?php if($tabaction =="default" || ""){ echo 'style="display:inherit;"; class"menu-tab-content-default active"';}else { echo 'style="display:none;" class"menu-tab-content"';} ?> >
<h3><?php _e( 'Query Query Defaults'); ?></h3>
<table class="widefat importers" cellspacing="0">
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<thead>
<tr>
<th><?php _e( 'Variable Name' ); ?></th>
<th><?php _e( 'Option Description' ); ?></th>
<th><?php _e( 'Custom Default' ); ?></th>
<th><?php _e( 'Preset Default' ); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($option_list_names as $option_list_name){
$evenodd ++;
//TEXT OPTIONS
if($option_list_name["type"]=="text"){
$value= "QueryQuery_".$option_list_name["name"];
?>
<tr class="<?php if ($evenodd % 2 == 0) {echo "even";}else{echo "alternate odd";} ?>">
<td class="queryvariable">"<?php echo $option_list_name["name"] ?>"</td>
<td class="import-system row-title"><label><?php _e( $option_list_name["title"] );?></label></td>
<td class="desc"><input type="text" name="<?php echo $value ?>" value="<?php echo get_option($value); ?>"/></td>
<td><?php echo $option_list_name["default"] ?> <input type="hidden" name="<?php echo $value.'_default'?>" value="<?php echo $option_list_name["default"] ?>" /> </td>
</tr>
<?php
}
//SELECT OPTIONS
if($option_list_name["type"]=="select"){
$value= "QueryQuery_".$option_list_name["name"];
?>
<tr class="<?php if ($evenodd % 2 == 0) {echo "even";}else{echo "alternate odd";}?>">
<td class="queryvariable">"<?php echo $option_list_name["name"] ?>"</td>
<td class="import-system row-title"><label><?php _e( $option_list_name["title"] ); ?></label></td>
<td class="desc">
<select name="<?php echo $value ?>" id="<?php echo $value ?>"><?php
$options_orderby = explode(',',$option_list_name["options"]) ;
foreach ($options_orderby as $option_orderby) {
$select_orderby= get_option($value);
if($select_orderby == $option_orderby){$ami_orderby='selected="selected"';}else{$ami_orderby='';};
echo '<option value="' . $option_orderby . '" id="'. $option_orderby .'"'. $ami_orderby.'>'. $option_orderby. '</option>';
}?></select>
</td>
<td><?php echo $option_list_name["default"] ?> <input type="hidden" name="<?php echo $value.'_default' ?>" value="<?php echo $option_list_name["default"] ?>" /> </td>
</tr>
<?php
}
//SELECT MULTI-OPTIONS
if($option_list_name["type"]=="multi-select"){
$options_orderby="";
$value= "QueryQuery_".$option_list_name["name"];
?>
<tr class="<?php if ($evenodd % 2 == 0) {echo "even";}else{echo "alternate odd";} ?>">
<td class="queryvariable">"<?php echo $option_list_name["name"] ?>"</td>
<td class="import-system row-title"><label><?php _e( $option_list_name["title"] ); ?></label></td>
<td class="desc">
<select multiple="multiple" name="<?php echo $value.'[]' ?>" id="<?php echo $value ?>"><?php
$option_list_name["name"] == "categorynumbers" || $option_list_name["name"] == "anticategorynumbers" ? $options_orderby = get_all_category_ids() : $options_orderby = $option_list_name["options"] ;
$select_orderby = get_option($value);
foreach ($options_orderby as $option_orderby) {
$option_list_name["name"] == "anticategorynumbers" ? $option_orderby_value = "-".$option_orderby: $option_orderby_value = $option_orderby ;
$selected = in_array($option_orderby_value,$select_orderby) !== false && $select_orderby !== "" ? 'selected="selected"' :" ";
echo '<option value="' . $option_orderby_value . '" id="'. $option_orderby .'"'. $selected.'>'. get_cat_name($option_orderby). '</option>';
}?></select>
</td>
<td><?php echo $option_list_name["default"] ?> <input type="hidden" name="<?php echo $value.'_default' ?>" value="<?php echo $option_list_name["default"] ?>" /> </td>
</tr>
<?php
}
//SELECT CHECK
if($option_list_name["type"]=="check"){
$value= "QueryQuery_".$option_list_name["name"];
?>
<tr class="<?php if ($evenodd % 2 == 0) {echo "even";}else{echo "alternate odd";}?>">
<td class="queryvariable">"<?php echo $option_list_name["name"] ?>"</td>
<td class="import-system row-title"><label><?php _e( $option_list_name["title"] ); ?></label></td>
<td class="desc">
<?
get_option($value) > 0 ? $checked = 'checked="checked"': $checked = " " ; // get our options array from the db
?>
<input type="checkbox" name="<?php echo $value ?>" id="<?php echo $value ?>" value="1>" <?php echo $checked ?>/>
</td>
<td><?php echo $option_list_name["default"] ?> <input type="hidden" name="<?php echo $value.'_default' ?>" value="<?php echo $option_list_name["default"] ?>" /> </td>
</tr>
<?php
}
}
?></tbody><tfoot>
<tr><td></td><td></td><td></td><td><input type="submit" name="Submit" value="Store Options" class="button button-primary"/></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="<?php
foreach ($option_list_names as $option_list_name){
echo "QueryQuery_".$option_list_name["name"]; $i ++;
if ($i != count($option_list_names)){echo ",";}
}?>" />
</td></tr>
</form>
</tfoot>
</table>
</div>
<?php } //end default content ?>
<?php
/*-----------------------------------------------------------------------------------------------------//
//EXAMPLE Tab
-------------------------------------------------------------------------------------------------------*/
include_once('QueryQuery_examples.php');
?>
<div id="menu-tab-examples" <?php if($tabaction =="examples"){ echo 'style="display:inherit;" class"menu-tab-content-examples active"';}else { echo 'style="display:none;"; class"menu-tab-content"';} ?>>
<h3><?php _e( 'Query Query Examples'); ?></h3>
<table class="widefat examples" cellspacing="0">
<thead>
<tr>
<th><?php _e( 'Name' ); ?></th>
<th><?php _e( 'Type' ); ?></th>
<th><?php _e( 'Example' ); ?></th>
<th><?php _e( 'Descrption' ); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($example_list_names as $example_list_name){ $evenodd2 ++; ?>
<tr class="<?php if ($evenodd2 % 2 == 0) {echo "even";}else{echo "alternate odd";} ?>">
<td><?php echo $example_list_name["title"]; ?></td>
<td><?php echo $example_list_name["type"]; ?></td>
<td><?php echo $example_list_name["example_text"]; ?></td>
<td rowspan="2"><?php echo $example_list_name["desc"]; ?></td>
</tr>
<tr class="<?php if ($evenodd2 % 2 == 0) {echo "even";}else{echo "alternate odd";} ?>">
<td colspan="3"><?php echo '<img class="queryquery-admin-image" src="'.plugins_url( '/assets/'.$example_list_name["image_name"] , __FILE__ ).'" alt="'.$example_list_name["title"].'"/>'; ?></td>
</tr>
<?php }//end example_lust)names?>
</tbody>
</table>
</div><!-- end of tab-options -->
</div><!-- end of wrap -->