MS_Rule_Post_ListTable

Membership List Table.

Defined (1)

The class is defined in the following location(s).

/app/rule/post/class-ms-rule-post-listtable.php  
  1. class MS_Rule_Post_ListTable extends MS_Helper_ListTable_Rule { 
  2.  
  3. protected $id = MS_Rule_Post::RULE_ID; 
  4.  
  5. public function __construct( $model ) { 
  6. parent::__construct( $model ); 
  7. $this->name['singular'] = __( 'Post', 'membership2' ); 
  8. $this->name['plural'] = __( 'Posts', 'membership2' ); 
  9.  
  10. public function get_columns() { 
  11. $columns = array( 
  12. 'cb' => true,  
  13. 'name' => __( 'Post title', 'membership2' ),  
  14. 'access' => true,  
  15. 'post_date' => __( 'Post date', 'membership2' ),  
  16. 'dripped' => true,  
  17. ); 
  18.  
  19. return apply_filters( 
  20. 'ms_helper_listtable_' . $this->id . '_columns',  
  21. $columns 
  22. ); 
  23.  
  24. public function get_sortable_columns() { 
  25. return apply_filters( 
  26. 'membership_helper_listtable_' . $this->id . '_sortable_columns',  
  27. array( 
  28. 'name' => array( 'name', false ),  
  29. 'dripped' => array( 'dripped', false ),  
  30. ); 
  31.  
  32. public function column_name( $item ) { 
  33. $actions = array( 
  34. sprintf( 
  35. '<a href="%s" target="_blank">%s</a>',  
  36. get_edit_post_link( $item->id, true ),  
  37. __( 'Edit', 'membership2' ) 
  38. ),  
  39. sprintf( 
  40. '<a href="%s" target="_blank">%s</a>',  
  41. get_permalink( $item->id ),  
  42. __( 'View', 'membership2' ) 
  43. ),  
  44. ); 
  45. $actions = apply_filters( 
  46. 'ms_rule_' . $this->id . '_column_actions',  
  47. $actions,  
  48. $item 
  49. ); 
  50.  
  51. return sprintf( 
  52. '%1$s %2$s',  
  53. $item->post_title,  
  54. $this->row_actions( $actions ) 
  55. ); 
  56.  
  57. public function column_post_date( $item, $column_name ) { 
  58. return MS_Helper_Period::format_date( $item->post_date ); 
  59.  
  60. /** 
  61. * Extra controls to be displayed between bulk actions and pagination 
  62. * @param string $which Either 'top' or 'bottom' 
  63. * @param bool $echo Output or return the HTML code? Default is output. 
  64. */ 
  65. public function extra_tablenav( $which, $echo = true ) { 
  66. if ( 'top' != $which ) { 
  67. return; 
  68.  
  69. $filter_button = array( 
  70. 'id' => 'filter_button',  
  71. 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT,  
  72. 'value' => __( 'Filter', 'membership2' ),  
  73. 'class' => 'button',  
  74. ); 
  75.  
  76. if ( ! $echo ) { ob_start(); } 
  77. ?> 
  78. <div class="alignleft actions"> 
  79. <?php 
  80. $this->months_dropdown( 'page' ); 
  81. MS_Helper_Html::html_element( $filter_button ); 
  82. ?> 
  83. </div> 
  84. <?php 
  85. if ( ! $echo ) { return ob_get_clean(); }