Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • Docs Home

Packages

  • Deposits-for-WooCommerce
    • Bookings
    • Cart
    • Order
    • Other
    • Payment-Plans
      • Views
    • Products
    • Settings

Classes

  • DFW_Deposits
  • DFW_Deposits_For_Bookings
  • DFW_Deposits_Plan
  • DFW_Deposits_Settings
  • DFW_License
  • DFW_Manage_Cart
  • DFW_Manage_Order_Items
  • DFW_Manage_Orders
  • DFW_Manage_Plans
  • DFW_Manage_Products
  • DFW_Payment_Plans_List
  • DFW_Plans_Admin_Settings
  • DFW_Product_Admin_Settings
  • DFW_Scheduled_Plan_Orders
  • DFW_Update_DB
  • EDD_DEPOSITS_Plugin_Updater

Functions

  • dfw_update_po_file
 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' );
}


/**
 * Display all the payment plans in a table under Payment Plans menu
 * 
 * @author Tyche Softwares
 * @since 1.0 
 * @category Classes
 * @package Deposits-for-WooCommerce/Payment-Plans/Views
 */


class DFW_Payment_Plans_List extends WP_List_Table {

    /**
     * Constructor Function
     * @since 1.0
     */
    public function __construct() {
        parent::__construct( array(
            'singular' => ' Payment Plans ',
            'plural'   => ' Payment Plans ',
            'ajax'     => false
        ));
    }

    /**
     * Display name of the payment plan under the 'Name' column
     * 
     * @param DFW_Deposits_Plan $item Payment Plan Object
     * @return string $name Name of the Payment Plan
     * @since 1.0
     */
    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;
    }

    /**
     * Display the description of the payment plan under the 'Description' column
     * 
     * @param DFW_Deposits_Plan $item Payment Plan Object
     * @return string 
     * @since 1.0
     */
    public function column_desc( $item ) {
        return  $item->get_plan_description();
    }

     /**
     * Display the schedule of the payment plan under the 'Description' column
     * 
     * @param DFW_Deposits_Plan $item Payment Plan Object
     * @return string 
     * @since 1.0
     */
    public function column_schedule( $item ) {
        return $item->get_formatted_plan_schedule();
    }

    /**
     * Add 3 columns to display the payment plans data
     * 
     * @return array $columns Columns to display in the table
     * @since 1.0
     */
    public function get_columns() {

        $columns = array (
            'name'     => __( 'Name', 'deposits-for-woocommerce' ),
            'desc'     => __( 'Description', 'deposits-for-woocommerce' ),
            'schedule' => __( 'Schedule', 'deposits-for-woocommerce')
        );

        return $columns;
    }

    /**
     * Display the payment plans data in the table
     * 
     * @since 1.0
     */
    public function prepare_items() {
        $this->_column_headers = array( $this->get_columns(), array(), array() );
        $this->items = DFW_Manage_Plans::get_plans();
    }
}
API documentation generated by ApiGen