1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
<?php
if( !class_exists( 'WP_List_Table' ) ) {
include_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class DFW_Payment_Plans_List extends WP_List_Table {
public function __construct() {
parent::__construct( array(
'singular' => ' Payment Plans ',
'plural' => ' Payment Plans ',
'ajax' => false
));
}
public function column_name( $item ){
$name = '
<strong>
<a href="' . esc_url( add_query_arg( 'plan_id', $item->get_plan_id(), admin_url( 'edit.php?post_type=product&page=dfw-payment-plans' ) ) ) . '">' . esc_html( $item->get_plan_name() ) . '</a>
</strong>
<div class="row-actions">
<a href="' . esc_url( add_query_arg( 'plan_id', $item->get_plan_id(), admin_url( 'edit.php?post_type=product&page=dfw-payment-plans' ) ) ) . '">' . __( 'Edit', 'deposits-for-woocommerce' ) . '</a> | <a href="' . wp_nonce_url( add_query_arg( 'delete_plan', $item->get_plan_id(), admin_url( 'edit.php?post_type=product&page=dfw-payment-plans' ) ), 'delete_plan' ) . '" class="delete_plan">' . __( 'Delete', 'deposits-for-woocommerce' ) . '</a>
</div>
';
return $name;
}
public function column_desc( $item ) {
return $item->get_plan_description();
}
public function column_schedule( $item ) {
return $item->get_formatted_plan_schedule();
}
public function get_columns() {
$columns = array (
'name' => __( 'Name', 'deposits-for-woocommerce' ),
'desc' => __( 'Description', 'deposits-for-woocommerce' ),
'schedule' => __( 'Schedule', 'deposits-for-woocommerce')
);
return $columns;
}
public function prepare_items() {
$this->_column_headers = array( $this->get_columns(), array(), array() );
$this->items = DFW_Manage_Plans::get_plans();
}
}