PluginProbe
Adminimize / 1.11.11
Adminimize v1.11.11
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
adminimize / inc-options / dashboard_options.php

dashboard_options.php in Adminimize 1.11.11, at inc-options/dashboard_options.php

214 lines 7.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Adminimize
4 * @subpackage Dashboard Options
5 * @author Frank Bültge
6 */
7 if ( ! function_exists( 'add_action' ) ) {
8 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
9 exit;
10 }
11
12 ?>
13
14 <div id="poststuff" class="ui-sortable meta-box-sortables">
15 <div class="postbox">
16 <h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="dashboard_options"><?php esc_attr_e( 'Dashboard options', 'adminimize' ); ?></h3>
17
18 <div class="inside">
19 <br class="clear" />
20 <?php
21 $disabled_dashboard_option_ = array();
22 // get widgets
23 $widgets = _mw_adminimize_get_option_value( 'mw_adminimize_dashboard_widgets' );
24 if ( NULL === $widgets ) {
25 echo '<p>';
26 esc_attr_e(
27 'To complete the installation for Dashboard Widgets you must visit your dashboard once and then come back to Settings > Adminimize to configure who has access to each widget.',
28 'adminimize'
29 );
30 echo '</p>';
31 } else {
32 ?>
33
34 <table summary="config_edit_dashboard" class="widefat">
35 <colgroup>
36 <?php
37 $col = 0;
38 foreach ( $user_roles_names as $role_name ) {
39 echo '<col class="col' . $col . '">' . "\n";
40 $col ++;
41 }
42 ?>
43 </colgroup>
44 <thead>
45 <tr>
46 <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>
47 <?php
48 foreach ( $user_roles_names as $role_name ) { ?>
49 <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
50 echo '<br/>' . $role_name; ?></th>
51 <?php } ?>
52 </tr>
53 <tr>
54 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
55 <?php
56 foreach ( $user_roles as $role_slug ) {
57 echo '<td class="num">';
58 echo '<input id="select_all" class="dashboard_options_' . $role_slug
59 . '" type="checkbox" name="" value="" />';
60 echo '</td>' . "\n";
61 } ?>
62 </tr>
63 </thead>
64
65 <tbody>
66 <?php
67 foreach ( $user_roles as $role ) {
68 $disabled_dashboard_option_[ $role ] = _mw_adminimize_get_option_value(
69 'mw_adminimize_disabled_dashboard_option_' . $role . '_items'
70 );
71 }
72
73 $dashboard_options = array();
74 $dashboard_options_names = array();
75 foreach ( $widgets as $widget ) {
76 // Object to array
77 if ( is_object( $widget ) ) {
78 $widget = get_object_vars( $widget );
79 }
80 $dashboard_options[] = $widget[ 'id' ];
81 $dashboard_options_names[] = $widget[ 'title' ];
82 }
83
84 $_mw_adminimize_own_dashboard_values = _mw_adminimize_get_option_value(
85 '_mw_adminimize_own_dashboard_values'
86 );
87 $_mw_adminimize_own_dashboard_values = preg_split( "/\r\n/", $_mw_adminimize_own_dashboard_values );
88 foreach ( (array) $_mw_adminimize_own_dashboard_values as $key => $_mw_adminimize_own_dashboard_value ) {
89 $_mw_adminimize_own_dashboard_value = trim( $_mw_adminimize_own_dashboard_value );
90 $dashboard_options[] = $_mw_adminimize_own_dashboard_value;
91 }
92
93 $_mw_adminimize_own_dashboard_options = _mw_adminimize_get_option_value(
94 '_mw_adminimize_own_dashboard_options'
95 );
96 $_mw_adminimize_own_dashboard_options = preg_split(
97 "/\r\n/", $_mw_adminimize_own_dashboard_options
98 );
99 foreach ( (array) $_mw_adminimize_own_dashboard_options as $key => $_mw_adminimize_own_dashboard_option ) {
100 $_mw_adminimize_own_dashboard_option = trim( $_mw_adminimize_own_dashboard_option );
101 $dashboard_options_names[] = $_mw_adminimize_own_dashboard_option;
102 }
103
104 $x = 0;
105 foreach ( $dashboard_options as $index => $dashboard_option ) {
106
107 if ( '' !== $dashboard_option ) {
108 $checked_user_role_ = array();
109 foreach ( $user_roles as $role ) {
110
111 $checked_user_role_[ $role ] = ( in_array(
112 $dashboard_option, (array) $disabled_dashboard_option_[ $role ], FALSE
113 ) ) ? ' checked="checked"' : '';
114
115 }
116 echo '<tr>' . "\n";
117
118 // No title on the Dashboard item.
119 if ( ! $dashboard_options_names[ $index ] ) {
120 $dashboard_options_names[ $index ] = '<b><i>' . esc_attr__(
121 'No Title!', 'adminimize'
122 ) . '</i></b>';
123 }
124 echo '<td>' . $dashboard_options_names[ $index ] . ' <span>(' . $dashboard_option . ')</span> </td>' . "\n";
125 foreach ( $user_roles as $role ) {
126 echo '<td class="num">';
127 echo '<input id="check_post' . $role . $x . '" class="dashboard_options_'
128 . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox"'
129 . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_dashboard_option_'
130 . $role . '_items[]" value="' . $dashboard_option . '" />';
131 echo '</td>';
132 }
133 echo '</tr>' . "\n";
134 $x ++;
135 }
136
137 }
138 ?>
139 </tbody>
140 </table>
141
142 <?php
143 //Your own dashboard options.
144 ?>
145 <br style="margin-top: 10px;" />
146 <table summary="config_edit_post" class="widefat">
147 <thead>
148 <tr>
149 <th><?php esc_attr_e( 'Your own options', 'adminimize' );
150 echo '<br />';
151 esc_attr_e( 'Option name', 'adminimize' ); ?></th>
152 <th><?php echo '<br />';
153 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
154 </tr>
155 </thead>
156
157 <tbody>
158 <tr valign="top">
159 <td colspan="2"><?php esc_attr_e(
160 'It is possible to add your own IDs or classes from elements and tags. You can find IDs and classes with the FireBug Add-on for Firefox. Assign a value and the associate name per line.',
161 'adminimize'
162 ); ?></td>
163 </tr>
164 <tr valign="top">
165 <td>
166 <textarea name="_mw_adminimize_own_dashboard_options" cols="60" rows="3"
167 id="_mw_adminimize_own_dashboard_options" style="width: 95%;"><?php
168 echo _mw_adminimize_get_option_value(
169 '_mw_adminimize_own_dashboard_options'
170 ); ?></textarea>
171 <br />
172 <label for="_mw_adminimize_own_dashboard_options">
173 <?php esc_attr_e(
174 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
175 'adminimize'
176 ); ?>
177 </label>
178 </td>
179 <td>
180 <textarea class="code" name="_mw_adminimize_own_dashboard_values" cols="60" rows="3"
181 id="_mw_adminimize_own_dashboard_values" style="width: 95%;"><?php
182 echo _mw_adminimize_get_option_value(
183 '_mw_adminimize_own_dashboard_values'
184 ); ?></textarea>
185 <br />
186 <label for="_mw_adminimize_own_dashboard_values">
187 <?php esc_attr_e(
188 'Possible IDs or classes. Separate multiple values through a carriage return.',
189 'adminimize'
190 ); ?>
191 </label>
192 </td>
193 </tr>
194 </tbody>
195 </table>
196
197 <p id="submitbutton">
198 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
199 <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
200 'Update Options', 'adminimize'
201 ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
202 </p>
203
204 <?php } // end if else $widgets ?>
205
206 <p>
207 <a class="alignright button adminimize-scroltop" href="#" style="margin:3px 0 0 30px;"><?php esc_attr_e(
208 'scroll to top', 'adminimize'
209 ); ?></a><br class="clear" /></p>
210
211 </div>
212 </div>
213 </div>
214