MS_View_Frontend_Invoices

The Membership 2 MS View Frontend Invoices class.

Defined (1)

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

/app/view/frontend/class-ms-view-frontend-invoices.php  
  1. class MS_View_Frontend_Invoices extends MS_View { 
  2.  
  3. public function to_html() { 
  4. ob_start(); 
  5. ?> 
  6. <div class="ms-account-wrapper"> 
  7. <?php if ( MS_Model_Member::is_logged_in() ): ?> 
  8. <h2> 
  9. <?php _e( 'Invoice', 'membership2' ); ?> 
  10. </h2> 
  11. <table> 
  12. <thead> 
  13. <tr> 
  14. <th class="ms-col-invoice-no"><?php 
  15. _e( 'Invoice #', 'membership2' ); 
  16. ?></th> 
  17. <th class="ms-col-invoice-status"><?php 
  18. _e( 'Status', 'membership2' ); 
  19. ?></th> 
  20. <th class="ms-col-invoice-total"><?php 
  21. printf( 
  22. '%s (%s)',  
  23. __( 'Total', 'membership2' ),  
  24. MS_Plugin::instance()->settings->currency 
  25. ); 
  26. ?></th> 
  27. <th class="ms-col-invoice-title"><?php 
  28. _e( 'Membership', 'membership2' ); 
  29. ?></th> 
  30. <th class="ms-col-invoice-due"><?php 
  31. _e( 'Due date', 'membership2' ); 
  32. ?></th> 
  33. </tr> 
  34. </thead> 
  35. <tbody> 
  36. <?php foreach ( $this->data['invoices'] as $invoice ) : 
  37. $inv_membership = MS_Factory::load( 'MS_Model_Membership', $invoice->membership_id ); 
  38. $inv_classes = array( 
  39. 'ms-invoice-' . $invoice->id,  
  40. 'ms-subscription-' . $invoice->ms_relationship_id,  
  41. 'ms-invoice-' . $invoice->status,  
  42. 'ms-gateway-' . $invoice->gateway_id,  
  43. 'ms-membership-' . $invoice->membership_id,  
  44. 'ms-type-' . $inv_membership->type,  
  45. 'ms-payment-' . $inv_membership->payment_type,  
  46. ); 
  47. ?> 
  48. <tr class="<?php echo esc_attr( implode( ' ', $inv_classes ) ); ?>"> 
  49. <td class="ms-col-invoice-no"><?php 
  50. printf( 
  51. '<a href="%s">%s</a>',  
  52. get_permalink( $invoice->id ),  
  53. $invoice->get_invoice_number() 
  54. ); 
  55. ?></td> 
  56. <td class="ms-col-invoice-status"><?php 
  57. echo esc_html( $invoice->status_text() ); 
  58. ?></td> 
  59. <td class="ms-col-invoice-total"><?php 
  60. echo esc_html( MS_Helper_Billing::format_price( $invoice->total ) ); 
  61. ?></td> 
  62. <td class="ms-col-invoice-title"><?php 
  63. echo esc_html( $inv_membership->name ); 
  64. ?></td> 
  65. <td class="ms-col-invoice-due"><?php 
  66. echo esc_html( 
  67. MS_Helper_Period::format_date( 
  68. $invoice->due_date,  
  69. __( 'F j', 'membership2' ) 
  70. ); 
  71. ?></td> 
  72. </tr> 
  73. <?php endforeach; ?> 
  74. </tbody> 
  75. </table> 
  76. <?php else : ?> 
  77. <?php 
  78. $redirect = esc_url_raw( add_query_arg( array() ) ); 
  79. $title = __( 'Your account', 'membership2' ); 
  80. echo do_shortcode( "[ms-membership-login redirect='$redirect' title='$title']" ); 
  81. ?> 
  82. <?php endif; ?> 
  83. </div> 
  84. <?php 
  85. $html = ob_get_clean(); 
  86. $html = apply_filters( 'ms_compact_code', $html ); 
  87.  
  88. return $html; 
  89.