| 1 |
<?php |
| 2 |
/** |
| 3 |
* Displays a list of provided records in a HTML Table |
| 4 |
* |
| 5 |
* @package WP_Stream |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WP_Stream; |
| 9 |
|
| 10 |
/** |
| 11 |
* Class - Preview_List_Table |
| 12 |
*/ |
| 13 |
class Preview_List_Table extends List_Table { |
| 14 |
|
| 15 |
/** |
| 16 |
* Class constructor. |
| 17 |
* |
| 18 |
* @param Plugin $plugin Plugin object. |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function __construct( $plugin ) { |
| 23 |
$this->plugin = $plugin; |
| 24 |
parent::__construct( $plugin ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Sets up the records for display. |
| 29 |
* |
| 30 |
* @param array $items List of items for display. |
| 31 |
* |
| 32 |
* @return void |
| 33 |
*/ |
| 34 |
public function set_records( $items ) { |
| 35 |
$columns = $this->get_columns(); |
| 36 |
$sortable = $this->get_sortable_columns(); |
| 37 |
$hidden = $this->get_hidden_columns(); |
| 38 |
$primary = $columns['summary']; |
| 39 |
|
| 40 |
$this->_column_headers = array( |
| 41 |
$columns, |
| 42 |
$hidden, |
| 43 |
$sortable, |
| 44 |
$primary, |
| 45 |
); |
| 46 |
|
| 47 |
$this->items = $items; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Display the table |
| 52 |
* |
| 53 |
* @since 3.1.0 |
| 54 |
* @access public |
| 55 |
*/ |
| 56 |
public function display() { |
| 57 |
?> |
| 58 |
<table class="wp-list-table <?php esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>"> |
| 59 |
<thead> |
| 60 |
<tr> |
| 61 |
<?php $this->print_column_headers(); ?> |
| 62 |
</tr> |
| 63 |
</thead> |
| 64 |
|
| 65 |
<tbody id="the-list"> |
| 66 |
<?php $this->display_rows_or_placeholder(); ?> |
| 67 |
</tbody> |
| 68 |
|
| 69 |
<tfoot> |
| 70 |
<tr> |
| 71 |
<?php $this->print_column_headers( false ); ?> |
| 72 |
</tr> |
| 73 |
</tfoot> |
| 74 |
|
| 75 |
</table> |
| 76 |
<?php |
| 77 |
} |
| 78 |
} |
| 79 |
|