/app/rule/page/class-ms-rule-page-listtable.php

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