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

Packages

  • None
  • Order-Delivery-Date-Pro-for-WooCommerce
    • Admin
      • Edit-Order
      • Non-Sensitive-Data-Capture
      • Settings
        • Custom-Delivery
        • General
        • Google-Calendar-Sync
    • Class-ORDDD-Email-Manager
    • Common-Functions
    • Delivery-Calendar
    • Emails
      • Class-ORDDD-Email-Update-Date
    • Filter
    • Frontend
      • Checkout-Page-Processes
      • ICS-Files-Data
    • Google-Calendar
    • Integration
    • Lang
    • License
    • Plugin-Updates
      • EDD-SL-Plugin-Updater

Classes

  • EDD_SL_Plugin_Updater
  • orddd_additional_settings
  • orddd_admin_delivery_class
  • orddd_appearance_settings
  • orddd_calendar_sync
  • orddd_calendar_sync_settings
  • orddd_class_view_deliveries
  • orddd_common
  • orddd_date_settings
  • orddd_delivery_days_settings
  • ORDDD_Email_Manager
  • ORDDD_Email_Update_Date
  • orddd_filter
  • orddd_holidays_settings
  • orddd_integration
  • orddd_license
  • orddd_process
  • orddd_settings
  • orddd_shipping_based_settings
  • orddd_shipping_days_settings
  • orddd_shipping_multiple_address
  • orddd_time_settings
  • orddd_time_slot_settings
  • ORDDD_View_Delivery_Dates_Table
  • ORDDD_View_Disable_Time_Slots_Table
  • ORDDD_View_Holidays_Table
  • ORDDD_View_Shipping_Settings_Table
  • ORDDD_View_Time_Slots_Table
  • OrdddGcal
  • order_delivery_date
  • TS_Tracker
  • TS_tracking

Functions

  • orddd_get_dateToCal
  • orddd_get_escapeString
  • orddd_t
  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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 
<?php 
// Load WP_List_Table if not loaded
if ( ! class_exists( 'WP_List_Table' ) ) {
    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}

/**
 * ORDDD View Holidays Table
 *
 * @author Tyche Softwares
 * @package Order-Delivery-Date-Pro-for-WooCommerce/Admin/Settings/General
 * @since 2.8.4
 */

class ORDDD_View_Holidays_Table extends WP_List_Table {

    /**
     * URL of this page
     *
     * @var string
     * @since 1.4.1
     */
    public $base_url;
    
    /**
     * Get things started
     *
     * @see WP_List_Table::__construct()
     */
    public function __construct() {

        global $status, $page;
        // Set parent defaults
        parent::__construct( array(
            'singular' => __( 'holiday', 'order-delivery-date' ), //singular name of the listed records
            'plural'   => __( 'holidays', 'order-delivery-date' ), //plural name of the listed records
            'ajax'      => false                        // Does this table support ajax?
        ) );
        $this->process_bulk_action();
        $this->base_url = admin_url( 'admin.php?page=order_delivery_date&action=general_settings&section=holidays' );
    }
    
    /**
     * Add delete option in the bulk actions dropdown
     * 
     * @since 2.8.4
     */
    public function get_bulk_actions() {
        return array(
            'orddd_delete' => __( 'Delete', 'order-delivery-date' )
        );
    }
    
    /**
     * Add the check box for the items to select 
     * 
     * @param string $item 
     * @return string
     * @since 2.8.4
     **/
    function column_cb( $item ){
        $row_id = '';
        if( isset( $item->holiday_date_stored ) && "" != $item->holiday_date_stored ){
            $row_id = $item->holiday_date_stored;
            return sprintf(
                '<input type="checkbox" name="%1$s[]" value="%2$s" />',
                'holiday',
                $row_id
            );
        }
    }
    
    /**
     * Prepare items to display in the table
     * 
     * @since 2.8.4
     */
    public function orddd_prepare_items() {
        $columns  = $this->get_columns();
        $hidden   = array(); // No hidden columns
        $data     = $this->orddd_shipping_settings_data();
        $sortable = array();
        $status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
        $this->_column_headers = array( $columns, $hidden, $sortable );
        $this->items = $data;
    }
    
    /**
     * Return columns to add in the table
     * 
     * @return array $columns Columns to be displayed in the table
     * @since 2.8.4
     */
    public function get_columns() {
        $columns = array(
            'cb'                 =>  '<input type="checkbox" />',
            'holiday_name'   => __( 'Name', 'order-delivery-date' ),
            'holiday_date'   => __( 'Date', 'order-delivery-date' ),
        );
        return apply_filters( 'orddd_holidays_table_columns', $columns );
    }
    
    /**
     * Displays the holidays data in the table
     * 
     * @return array $return_holidays Name & date for the holidays
     * @since 2.8.4
     */
    
    public function orddd_shipping_settings_data() { 
        global $wpdb, $woocommerce, $orddd_weekdays;
        $holidays_arr = $return_holidays = array();
        $holidays = get_option( 'orddd_delivery_date_holidays' );
        if ( $holidays != '' && $holidays != '{}' && $holidays != '[]' && $holidays != 'null' ) {
            $holidays_arr = json_decode( $holidays );
        }
        $holiday_count = 0;
        foreach ( $holidays_arr as $key => $value ) {
            $return_holidays[ $key ] = new stdClass();
            $return_holidays[ $key ]->holiday_name = $value->n;
            
            $date_from_arr = explode( "-", $value->d );
            $holiday_date = date( 'm-d-Y', gmmktime( 0, 0, 0, $date_from_arr[ 0 ], $date_from_arr[ 1 ], $date_from_arr[ 2 ] ) );
            $return_holidays[ $key ]->holiday_date = $holiday_date;
            $return_holidays[ $key ]->holiday_date_stored = $value->d;
        }
        return apply_filters( 'orddd_shipping_settings_table_data', $return_holidays );
    }
    
    /**
     * Add Edit and Delete link in each row of the table data
     * 
     * @param resource $shipping_settings
     * @param string $column_name
     * @return array
     * @since 2.8.4
     */
    public function column_default( $holiday_settings, $column_name ) {
        $value = isset( $holiday_settings->$column_name ) ? $holiday_settings->$column_name : '';
        return apply_filters( 'bkap_booking_table_column_default', $value, $holiday_settings, $column_name );
    }   
}
?>
API documentation generated by ApiGen