*/ class Aior_Reservation_List { /** * Initialize the class and set its properties. * * @since 1.0.0 */ public function __construct() { add_action( 'init', array( $this, 'custom_post_type_reservation' ), 0 ); add_action( 'add_meta_boxes', array( $this, 'add_meta_box_reseveration' ) ); add_action( 'manage_posts_extra_tablenav', array( $this, 'export_button_csv_reservation_form' ), 20, 1 ); add_action( 'init', array( $this, 'export_csv_reservation_form' ) ); add_action( 'aoir_reservation_global_ajax', array( $this, 'import_json_reservation_from_ajax' ), 10, 1 ); } /** * Reservation List Custom Post Type. * * @since 1.0.0 */ public function custom_post_type_reservation() { $labels = array( 'name' => _x( 'Reservations', 'Post Type General Name', 'all-in-one-reservation' ), 'singular_name' => _x( 'Reservation', 'Post Type Singular Name', 'all-in-one-reservation' ), 'menu_name' => esc_html__( 'Reservation', 'all-in-one-reservation' ), 'name_admin_bar' => esc_html__( 'Reservation', 'all-in-one-reservation' ), 'archives' => esc_html__( 'Reservation Archives', 'all-in-one-reservation' ), 'attributes' => esc_html__( 'Reservation Attributes', 'all-in-one-reservation' ), 'parent_item_colon' => esc_html__( 'Parent Reservation:', 'all-in-one-reservation' ), 'all_items' => esc_html__( 'All Reservations', 'all-in-one-reservation' ), 'add_new_item' => esc_html__( 'Add New Reservation', 'all-in-one-reservation' ), 'add_new' => esc_html__( 'Add New', 'all-in-one-reservation' ), 'new_item' => esc_html__( 'New Reservation', 'all-in-one-reservation' ), 'edit_item' => esc_html__( 'Edit Reservation', 'all-in-one-reservation' ), 'update_item' => esc_html__( 'Update Reservation', 'all-in-one-reservation' ), 'view_item' => esc_html__( 'View Reservation', 'all-in-one-reservation' ), 'view_items' => esc_html__( 'View Reservations', 'all-in-one-reservation' ), 'search_items' => esc_html__( 'Search Reservation', 'all-in-one-reservation' ), 'not_found' => esc_html__( 'Not found', 'all-in-one-reservation' ), 'not_found_in_trash' => esc_html__( 'Not found in Trash', 'all-in-one-reservation' ), 'featured_image' => esc_html__( 'Featured Image', 'all-in-one-reservation' ), 'set_featured_image' => esc_html__( 'Set featured image', 'all-in-one-reservation' ), 'remove_featured_image' => esc_html__( 'Remove featured image', 'all-in-one-reservation' ), 'use_featured_image' => esc_html__( 'Use as featured image', 'all-in-one-reservation' ), 'insert_into_item' => esc_html__( 'Insert into Reservation', 'all-in-one-reservation' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this Reservation', 'all-in-one-reservation' ), 'items_list' => esc_html__( 'Reservations list', 'all-in-one-reservation' ), 'items_list_navigation' => esc_html__( 'Reservations list navigation', 'all-in-one-reservation' ), 'filter_items_list' => esc_html__( 'Filter Reservations list', 'all-in-one-reservation' ), ); $args = array( 'label' => esc_html__( 'Reservation', 'all-in-one-reservation' ), 'description' => esc_html__( 'Summited form date of Reservation', 'all-in-one-reservation' ), 'labels' => $labels, 'supports' => array( 'title' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => false, 'menu_position' => 5, 'menu_icon' => 'dashicons-cart', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => false, 'rewrite' => false, 'capability_type' => 'post', 'capabilities' => array( 'create_posts' => false, ), 'map_meta_cap' => true, ); register_post_type( 'reservation', $args ); } /** * Add Meta Box in Reservation List. * * @since 1.0.0 */ public function add_meta_box_reseveration() { add_meta_box( 'aior_booking_data', esc_html__( 'Booking Data', 'all-in-one-reservation' ), array( $this, 'booking_info' ), 'reservation', 'advanced', 'default', 'post' ); } /** * Booking Information. * * @since 1.0.0 */ public function booking_info() { $bid = get_the_id(); $fid = get_post_meta( $bid, 'form_id', true ); $form_json = get_post_meta( $fid, 'form_json', true ); $form_array = json_decode( $form_json, true ); $aior_builder = new Aior_Builder(); if ( $form_array ) { foreach ( $form_array as $row ) { echo '