| 1 |
<?php |
| 2 |
namespace MaxButtons; |
| 3 |
defined('ABSPATH') or die('No direct access permitted'); |
| 4 |
|
| 5 |
?> |
| 6 |
|
| 7 |
<!-- @todo Remove --> |
| 8 |
<script type="text/javascript"> |
| 9 |
jQuery(document).ready(function() { |
| 10 |
jQuery("#bulk-action-all").click(function() { |
| 11 |
jQuery("#maxbuttons input[name='button-id[]']").each(function() { |
| 12 |
if (jQuery("#bulk-action-all").is(":checked")) { |
| 13 |
jQuery(this).attr("checked", "checked"); |
| 14 |
} |
| 15 |
else { |
| 16 |
jQuery(this).removeAttr("checked"); |
| 17 |
} |
| 18 |
}); |
| 19 |
}); |
| 20 |
|
| 21 |
}); |
| 22 |
</script> |
| 23 |
|
| 24 |
<?php |
| 25 |
$page_title = __("Overview","maxbuttons"); |
| 26 |
$action = "<a class='page-title-action add-new-h2' href='" . $this->getButtonLink() . "'>" . __('Add New', 'maxbuttons') . "</a>"; |
| 27 |
$this->mbadmin->get_header(array("title" => $page_title, "title_action" => $action)); |
| 28 |
?> |
| 29 |
|
| 30 |
<div class="form-actions"> |
| 31 |
<a class="button-primary" href="<?php echo $this->getButtonLink(); ?>"><?php _e('Add New', 'maxbuttons') ?></a> |
| 32 |
</div> |
| 33 |
|
| 34 |
<?php foreach ($this->messages as $message) { ?> |
| 35 |
<div class="mb-notice mb-message"><?php echo $message ?></div> |
| 36 |
<?php } |
| 37 |
?> |
| 38 |
|
| 39 |
|
| 40 |
<p class="status"> |
| 41 |
<?php |
| 42 |
$url = $this->getListLink(); // admin_url() . "admin.php?page=maxbuttons-controller&action=list"; |
| 43 |
$trash_url = $this->getListLink('trash'); // $url . "&view=trash"; |
| 44 |
|
| 45 |
if ($view->listView == 'trash') |
| 46 |
{ |
| 47 |
$all_line = "<strong><a href='$url'>" . __('All', 'maxbuttons') . "</strong></a>"; |
| 48 |
$trash_line = __("Trash", "maxbuttons"); |
| 49 |
} |
| 50 |
else |
| 51 |
{ |
| 52 |
$all_line = __("All","maxbuttons"); |
| 53 |
$trash_line = "<a href='$trash_url'>" . __("Trash","maxbuttons") . "</strong></a>"; |
| 54 |
} |
| 55 |
?> |
| 56 |
<?php echo $all_line ?><span class="count"> (<?php echo $view->published_buttons_count ?>)</span> |
| 57 |
|
| 58 |
<?php if ($view->trashed_buttons_count > 0) { ?> |
| 59 |
<span class="separator">|</span> |
| 60 |
<?php echo $trash_line ?> <span class="count">(<?php echo $view->trashed_buttons_count ?>)</span> |
| 61 |
<?php } ?> |
| 62 |
</p> |
| 63 |
<?php |
| 64 |
do_action("mb-display-meta"); |
| 65 |
|
| 66 |
?> |
| 67 |
<form method="post"> |
| 68 |
<?php wp_nonce_field("button-copy","copy_nonce"); ?> |
| 69 |
<?php wp_nonce_field("button-delete","delete_nonce"); ?> |
| 70 |
<?php wp_nonce_field('button-trash', 'trash_nonce'); ?> |
| 71 |
<?php wp_nonce_field('button-restore', 'restore_nonce'); ?> |
| 72 |
<?php wp_nonce_field('button-empty-trash', 'empty-trash_nonce'); ?> |
| 73 |
|
| 74 |
<?php if (isset($page_args['paged'])) : ?> |
| 75 |
<input type="hidden" name="paged" value="<?php echo $view->pageArgs['paged'] ?>" /> |
| 76 |
<?php endif; ?> |
| 77 |
|
| 78 |
<input type="hidden" name="view" value="<?php echo $view->listView ?>" /> |
| 79 |
<?php wp_nonce_field("mb-list","mb-list-nonce"); ?> |
| 80 |
|
| 81 |
<select name="bulk-action-select" id="bulk-action-select"> |
| 82 |
<option value=""><?php _e('Bulk Actions', 'maxbuttons') ?></option> |
| 83 |
<?php if ($view->listView == 'all'): ?> |
| 84 |
|
| 85 |
<option value="trash"><?php _e('Move to Trash', 'maxbuttons') ?></option> |
| 86 |
<?php endif; |
| 87 |
if ($view->listView == 'trash'): ?> |
| 88 |
<option value="restore"><?php _e('Restore', 'maxbuttons') ?></option> |
| 89 |
<option value="delete"><?php _e('Delete Permanently', 'maxbuttons') ?></option> |
| 90 |
<?php endif; ?> |
| 91 |
</select> |
| 92 |
<input type="submit" class="button" value="<?php _e('Apply', 'maxbuttons') ?>" /> |
| 93 |
|
| 94 |
<?php if ($view->listView == 'trash'): ?> |
| 95 |
<button type="button" class='button alignright' value='empty-trash' data-buttonaction='empty-trash' data-confirm="<?php _e('Permanently delete all buttons in trash. Are you sure?', 'maxbuttons-pro') ?>"><?php _e('Empty Trash', 'maxbuttons'); ?></button> |
| 96 |
<?php endif; ?> |
| 97 |
<?php do_action("mb-display-pagination", $view->pageArgs, 'top'); ?> |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
<?php // Sorting |
| 102 |
$link_order = ($view->pageArgs['order'] == "DESC") ? "ASC" : 'DESC'; |
| 103 |
|
| 104 |
$name_sort_url = add_query_arg(array( |
| 105 |
"orderby" => "name", |
| 106 |
"order" => $link_order |
| 107 |
)); |
| 108 |
$id_sort_url = add_query_arg(array( |
| 109 |
"orderby" => "id", |
| 110 |
"order" => $link_order |
| 111 |
)); |
| 112 |
|
| 113 |
$sort_arrow = ( strtolower($view->pageArgs["order"]) == 'desc') ? 'dashicons-arrow-down' : 'dashicons-arrow-up' |
| 114 |
?> |
| 115 |
|
| 116 |
<div class="button-list preview-buttons"> |
| 117 |
|
| 118 |
<div class="heading"> |
| 119 |
<span class='col col_check'><input type="checkbox" name="bulk-action-all" id="bulk-action-all" /></span> |
| 120 |
<span class='col col_button'> |
| 121 |
<a href="<?php echo $id_sort_url ?>"> |
| 122 |
<?php _e('Button', 'maxbuttons') ?> |
| 123 |
<?php if ($view->pageArgs["orderby"] == 'id') |
| 124 |
echo "<span class='dashicons $sort_arrow'></span>"; |
| 125 |
?> |
| 126 |
</a> |
| 127 |
</span> |
| 128 |
<span class="col col_name manage-column column-name sortable <?php echo strtolower($link_order) ?>"> |
| 129 |
<a href="<?php echo $name_sort_url ?>"> |
| 130 |
<span><?php _e('Name and Description', 'maxbuttons') ?></span> |
| 131 |
<?php if ($view->pageArgs["orderby"] == 'name') |
| 132 |
echo "<span class='dashicons $sort_arrow'></span>"; |
| 133 |
?> |
| 134 |
|
| 135 |
</a> |
| 136 |
</span> |
| 137 |
<span class='col col_shortcode'><?php _e('Shortcode', 'maxbuttons') ?></span> |
| 138 |
</div> <!-- heading --> |
| 139 |
|
| 140 |
<?php |
| 141 |
foreach ($view->published_buttons as $b): |
| 142 |
$id = $b['id']; |
| 143 |
|
| 144 |
if($view->listView == 'trash') |
| 145 |
$this->button->set($id,'','trash'); |
| 146 |
else |
| 147 |
$this->button->set($id); |
| 148 |
?> |
| 149 |
<div class='button-row'> |
| 150 |
<span class="col col_check"><input type="checkbox" name="button-id[]" id="button-id-<?php echo $id ?>" value="<?php echo $id ?>" /></span> |
| 151 |
<span class="col col_button"><div class="shortcode-container"> |
| 152 |
<?php |
| 153 |
$this->button->display( array("mode" => "preview") ); |
| 154 |
?> |
| 155 |
</div> |
| 156 |
<div class="actions"> |
| 157 |
<?php if($view->listView == 'all') : ?> |
| 158 |
<a href="<?php echo $this->getButtonLink($id); ?>"><?php _e('Edit', 'maxbuttons') ?></a> |
| 159 |
<span class="separator">|</span> |
| 160 |
<a href='javascript:void(0);' data-buttonaction='copy' data-buttonid="<?php echo $id ?>"><?php _e('Copy', 'maxbuttons') ?></a> |
| 161 |
<span class="separator">|</span> |
| 162 |
<a href="javascript:void(0)" data-buttonaction='trash' data-buttonid="<?php echo $id ?>"><?php _e('Move to Trash', 'maxbuttons') ?></a> |
| 163 |
<?php endif; |
| 164 |
if ($view->listView == 'trash'): |
| 165 |
?> |
| 166 |
<a href="javascript:void(0);" data-buttonaction='restore' data-buttonid="<?php echo $id ?>"><?php _e('Restore', 'maxbuttons') ?></a> |
| 167 |
<span class="separator">|</span> |
| 168 |
<a href="javascript:void(0);" data-buttonaction='delete' data-buttonid="<?php echo $id ?>"><?php _e('Delete Permanently', 'maxbuttons') ?></a> |
| 169 |
<?php endif; ?> |
| 170 |
</div> |
| 171 |
|
| 172 |
|
| 173 |
</span> |
| 174 |
<span class="col col_name"><a class="button-name" href="<?php echo $this->getButtonLink($id); ?>"><?php echo $this->button->getName() ?></a> |
| 175 |
<br /> |
| 176 |
<p><?php echo $this->button->getDescription() ?></p> |
| 177 |
</span> |
| 178 |
<span class="col col_shortcode"> [maxbutton id="<?php echo $id ?>"] <br /><strong><?php _e('or', 'maxbuttons'); ?></strong><br /> |
| 179 |
[maxbutton name="<?php echo $this->button->getName() ?>"] |
| 180 |
|
| 181 |
<?php |
| 182 |
if ($this->button->getUpdated(false) > 0) : ?> |
| 183 |
<span class='last-update'>Updated <?php echo $this->button->getUpdated(); ?></span> |
| 184 |
<?php endif; ?> |
| 185 |
</span> |
| 186 |
</div> |
| 187 |
<?php endforeach; |
| 188 |
|
| 189 |
// buttons ?> |
| 190 |
|
| 191 |
</div> <!-- button-list --> |
| 192 |
</form> |
| 193 |
|
| 194 |
<div class=''> |
| 195 |
<?php |
| 196 |
if (count($view->published_buttons) == 0): |
| 197 |
include('maxbuttons-welcome.php'); |
| 198 |
endif; |
| 199 |
?> |
| 200 |
</div> |
| 201 |
|
| 202 |
|
| 203 |
<?php do_action("mb-display-pagination", $view->pageArgs, 'bottom'); ?> |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
</div> |
| 208 |
<div class="ad-wrap"> |
| 209 |
<?php do_action("mb-display-ads"); ?> |
| 210 |
</div> |
| 211 |
|
| 212 |
<?php $this->mbadmin->get_footer(); ?> |
| 213 |
|