]> git.nbdom.net Git - nb.git/commitdiff
Bed
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 20 Apr 2016 23:18:08 +0000 (00:18 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 20 Apr 2016 23:18:08 +0000 (00:18 +0100)
lib/php/db/wp.php

index 608b00d162a9c4af13b312e78e9851bbc4d4fc37..24b362d23abebacdc48c0e10f6b2086a076c774f 100644 (file)
@@ -11,9 +11,34 @@ class html_table extends WP_List_Table {
     #$fields = $this->get_columns();
     #debug($sort);
     $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
+    $_REQUEST['s'] = ' ';
+    $this->search_box();
     return;
   }
 
+       public function search_box( $text='Search', $input_id='db' ) {
+               if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
+                       return;
+
+    echo '<p class="search-box">';
+               $input_id = $input_id . '-search-input';
+
+               if ( ! empty( $_REQUEST['orderby'] ) )
+                       echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
+               if ( ! empty( $_REQUEST['order'] ) )
+                       echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
+               if ( ! empty( $_REQUEST['post_mime_type'] ) )
+                       echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
+               if ( ! empty( $_REQUEST['detached'] ) )
+                       echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
+
+         submit_button( $text, 'button', '', false, array('id' => 'search-submit') );
+    echo '</p>';
+  /*
+       <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
+       <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
+  */
+       }
        protected function column_default( $item, $column_name ) { echo $item[$column_name]; }
 
        public function get_columns() {