| 1 |
<?php |
| 2 |
|
| 3 |
// Code for all dashboard widgets will go here |
| 4 |
|
| 5 |
class edit_flow_dashboard { |
| 6 |
|
| 7 |
function __construct ( ) { |
| 8 |
add_action('wp_dashboard_setup', array(&$this, 'add_dashboard_widgets') ); |
| 9 |
} |
| 10 |
|
| 11 |
function add_dashboard_widgets ( ) { |
| 12 |
global $edit_flow; |
| 13 |
|
| 14 |
// Set up Post Status widget |
| 15 |
// But, first check to see if it's enabled |
| 16 |
if($edit_flow->get_plugin_option('post_status_widget_enabled')) wp_add_dashboard_widget('post_status_widget', 'Unpublished Content', array(&$this, 'post_status_widget')); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Creates Post Status widget |
| 21 |
* Display an at-a-glance view of post counts for all custom statuses in the system |
| 22 |
*/ |
| 23 |
function post_status_widget ( ) { |
| 24 |
global $edit_flow; |
| 25 |
|
| 26 |
$statuses = $edit_flow->custom_status->get_custom_statuses(); |
| 27 |
?> |
| 28 |
<p class="sub">Posts at a Glance</p> |
| 29 |
|
| 30 |
<div class="table"> |
| 31 |
<table> |
| 32 |
<tbody> |
| 33 |
|
| 34 |
<?php foreach($statuses as $status) : ?> |
| 35 |
<?php $filter_link = get_custom_status_filter_link($status->slug) ?> |
| 36 |
<tr> |
| 37 |
<td class="b"> |
| 38 |
<a href="<?php echo $filter_link; ?>"> |
| 39 |
<?php echo get_custom_status_post_count($status->slug); ?> |
| 40 |
</a> |
| 41 |
</td> |
| 42 |
<td> |
| 43 |
<a href="<?php echo $filter_link; ?>"><?php echo $status->name ?></a> |
| 44 |
<span class="small"><a href="<?php echo get_custom_status_edit_link($status->term_id) ?>">[edit]</a></span> |
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
|
| 48 |
<?php endforeach; ?> |
| 49 |
</tbody> |
| 50 |
</table> |
| 51 |
</div> |
| 52 |
<?php |
| 53 |
} |
| 54 |
|
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
?> |