tool-list.php
109 lines
| 1 | <?php $trashedCount = $this->post_repo->trashedCount($this->post_type->name); ?> |
| 2 | <div class="nestedpages-tools"> |
| 3 | |
| 4 | <ul class="subsubsub"> |
| 5 | <li> |
| 6 | <a href="#all" class="np-toggle-publish active"><?php _e('All'); ?></a> | |
| 7 | </li> |
| 8 | |
| 9 | <li> |
| 10 | <a href="#published" class="np-toggle-publish"><?php _e('Published'); ?></a> | |
| 11 | </li> |
| 12 | |
| 13 | <li> |
| 14 | <a href="#show" class="np-toggle-hidden"><?php _e('Show Hidden', 'nestedpages'); ?> </a> |
| 15 | <span class="count">(<?php echo $this->post_repo->getHiddenCount(array($this->post_type->name)); ?>)</span> | |
| 16 | </li> |
| 17 | |
| 18 | <?php if ( current_user_can('delete_pages') && $trashedCount > 0) : ?> |
| 19 | <li class="np-trash-links"> |
| 20 | <a href="<?php echo $this->post_type_repo->trashLink($this->post_type->name); ?>"><?php _e('Trash'); ?> </a> |
| 21 | <span class="count">(<a href="#" class="np-empty-trash" data-posttype="<?php echo $this->post_type->name; ?>"><?php _e('Empty', 'nestedpages'); ?></a> <?php echo $trashedCount; ?>)</span> |
| 22 | | |
| 23 | </li> |
| 24 | <?php endif; ?> |
| 25 | |
| 26 | <?php if ( !$this->post_type_repo->hideDefault($this->post_type->name) ) : ?> |
| 27 | <li> |
| 28 | <a href="<?php echo NestedPages\Helpers::defaultPagesLink($this->post_type->name); ?>"> |
| 29 | <?php _e('Default'); ?> <?php _e($this->post_type->labels->name); ?> |
| 30 | </a> |
| 31 | </li> |
| 32 | <?php endif; ?> |
| 33 | </ul> |
| 34 | |
| 35 | <?php if ( !$this->post_type->hierarchical ) : ?> |
| 36 | <div class="np-tools-primary"> |
| 37 | <form action="<?php echo admin_url('admin-post.php'); ?>" method="post" class="np-tools-sort"> |
| 38 | <input type="hidden" name="action" value="npListingSort"> |
| 39 | <input type="hidden" name="page" value="<?php echo $this->pageURL(); ?>"> |
| 40 | <div class="select first"> |
| 41 | <select id="np_sortauthor" name="np_author" class="nestedpages-sort"> |
| 42 | <?php |
| 43 | $out = '<option value="all">' . __('All Authors', 'nestedpages') . '</option>'; |
| 44 | $users = $this->user->allUsers(); |
| 45 | foreach( $users as $user ){ |
| 46 | $out .= '<option value="' . $user->ID . '"'; |
| 47 | if ( isset($_GET['author']) && ($_GET['author'] == $user->ID) ) $out .= ' selected'; |
| 48 | $out .= '>' . $user->display_name . '</option>'; |
| 49 | } |
| 50 | echo $out; |
| 51 | ?> |
| 52 | </select> |
| 53 | </div> |
| 54 | <div class="select"> |
| 55 | <select id="np_orderby" name="np_orderby" class="nestedpages-sort"> |
| 56 | <?php |
| 57 | $options = array( |
| 58 | 'menu_order' => __('Menu Order', 'nestedpages'), |
| 59 | 'date' => __('Date', 'nestedpages'), |
| 60 | 'title' => __('Title', 'nestedpages') |
| 61 | ); |
| 62 | $out = '<option value="">' . __('Order By', 'nestedpages') . '</option>'; |
| 63 | foreach ( $options as $key => $option ){ |
| 64 | $out .= '<option value="' . $key . '"'; |
| 65 | if ( isset($_GET['orderby']) && ($_GET['orderby'] == $key) ) $out .= ' selected'; |
| 66 | $out .= '>' . $option . '</option>'; |
| 67 | } |
| 68 | echo $out; |
| 69 | ?> |
| 70 | </select> |
| 71 | </div> |
| 72 | <div class="select"> |
| 73 | <select id="np_order" name="np_order" class="nestedpages-sort"> |
| 74 | <?php |
| 75 | $options = array( |
| 76 | 'ASC' => __('Ascending', 'nestedpages'), |
| 77 | 'DESC' => __('Decending', 'nestedpages') |
| 78 | ); |
| 79 | $out = ''; |
| 80 | foreach ( $options as $key => $option ){ |
| 81 | $out .= '<option value="' . $key . '"'; |
| 82 | if ( isset($_GET['order']) && ($_GET['order'] == $key) ) $out .= ' selected'; |
| 83 | $out .= '>' . $option . '</option>'; |
| 84 | } |
| 85 | echo $out; |
| 86 | ?> |
| 87 | </select> |
| 88 | </div> |
| 89 | <div class="select"> |
| 90 | <input type="submit" id="nestedpages-sort" class="button" value="Apply"> |
| 91 | </div> |
| 92 | </form> |
| 93 | </div> |
| 94 | <?php endif; ?> |
| 95 | |
| 96 | |
| 97 | <div class="np-tools-search"> |
| 98 | <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"> |
| 99 | <input type="hidden" name="action" value="npSearch"> |
| 100 | <input type="hidden" name="posttype" value="<?php echo $this->post_type->name; ?>"> |
| 101 | <input type="hidden" name="page" value="<?php echo $this->pageURL(); ?>"> |
| 102 | <?php wp_nonce_field('nestedpages-nonce', 'nonce'); ?> |
| 103 | <input type="search" name="search_term" id="nestedpages-search" placeholder="<?php echo $this->post_type->labels->search_items; ?>" <?php if ( $this->isSearch() ) echo ' value="' . sanitize_text_field($_GET['search']) . '"'; ?>> |
| 104 | <input type="submit" name="" class="button" value="<?php echo $this->post_type->labels->search_items;?>"> |
| 105 | </form> |
| 106 | </div><!-- .np-tools-search --> |
| 107 | |
| 108 | |
| 109 | </div><!-- .nestedpages-tools --> |