MS_View_Membership_News

The News section is a sub-page of the Overview.

Defined (1)

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

/app/view/membership/class-ms-view-membership-news.php  
  1. class MS_View_Membership_News extends MS_View { 
  2.  
  3. /** 
  4. * Create view output. 
  5. * @since 1.0.0 
  6. * @return string 
  7. */ 
  8. public function to_html() { 
  9. $list_table = MS_Factory::create( 'MS_Helper_ListTable_Event' ); 
  10. $list_table->prepare_items(); 
  11.  
  12. if ( isset( $_REQUEST['membership_id'] ) ) { 
  13. $membership = MS_Factory::load( 'MS_Model_Membership', $_REQUEST['membership_id'] ); 
  14. $title = sprintf( 
  15. __( '%s News', 'membership2' ),  
  16. $membership->get_name_tag() 
  17. ); 
  18. $url = esc_url_raw( 
  19. add_query_arg( 
  20. array( 'step' => MS_Controller_Membership::STEP_OVERVIEW ),  
  21. remove_query_arg( array( 'paged', 'order', 'post_mime_type', 'detached', 'orderby', 's' ) ) 
  22. ); 
  23. $back_link = array( 
  24. 'id' => 'back',  
  25. 'type' => MS_Helper_Html::TYPE_HTML_LINK,  
  26. 'value' => __( '» Back to Overview', 'membership2' ),  
  27. 'url' => $url,  
  28. 'class' => 'wpmui-field-button button',  
  29. ); 
  30. } else { 
  31. $title = __( 'Membership News', 'membership2' ); 
  32. $back_link = ''; 
  33.  
  34. ob_start(); 
  35. ?> 
  36.  
  37. <div class="wrap ms-wrap ms-membership-news"> 
  38. <?php 
  39. MS_Helper_Html::settings_header( 
  40. array( 'title' => $title ) 
  41. ); 
  42.  
  43. MS_Helper_Html::html_element( $back_link ); 
  44.  
  45. $list_table->search_box(); 
  46. $list_table->views(); 
  47. ?> 
  48. <form action="" method="post"> 
  49. <?php $list_table->display(); ?> 
  50. </form> 
  51. </div> 
  52.  
  53. <?php 
  54. $html = ob_get_clean(); 
  55. echo '' . $html;