0) || $action=='add')
ticketdrum_ticket_edit();
elseif ($id>0 && $action=='delete_check')
{
?>
get_results($wpdb->prepare("SELECT t.id,t.title,t.price,t.active,t.event_id,e.title AS event_title FROM %i t LEFT JOIN %i e ON e.id=t.event_id ORDER BY e.start_datetime ASC, t.title ASC",TICKETDRUM_TICKETS_TABLE,TICKETDRUM_EVENTS_TABLE),ARRAY_A);
?>
|
|
|
|
|
|
|
'.esc_html__('no event','ticketdrum').''; ?> |
|
'.esc_html__('Active','ticketdrum').'':''.esc_html__('Inactive','ticketdrum').''; ?> |
|
|
update(
TICKETDRUM_TICKETS_TABLE, //table
array('event_id' => absint(wp_unslash($_POST['event_id'] ?? 0)),'title' => sanitize_text_field(wp_unslash($_POST['title'] ?? '')),'price'=>(float)sanitize_text_field(wp_unslash($_POST['price'] ?? 0)),'tax'=>(isset($_POST['tax']) && $_POST['tax']!=='' && !isset($_POST['default_tax']))?(float)sanitize_text_field(wp_unslash($_POST['tax'])):null,'max_purchase_quantity'=>absint(wp_unslash($_POST['max_purchase_quantity'] ?? 10)),'attendee_count'=>absint(wp_unslash($_POST['attendee_count'] ?? 1)),'active'=>(int)!empty($_POST['active']),'custom_fields'=>sanitize_text_field(wp_unslash($_POST['custom_fields'] ?? ''))), //data
array('ID' => $id) //where
);
}
elseif (sanitize_key(wp_unslash($_POST['action'] ?? ''))=='insert' && check_admin_referer('ticketdrum_ticket_edit'))
{
$wpdb->insert(
TICKETDRUM_TICKETS_TABLE, //table
array('event_id' => absint(wp_unslash($_POST['event_id'] ?? 0)),'title' => sanitize_text_field(wp_unslash($_POST['title'] ?? '')),'price'=>(float)sanitize_text_field(wp_unslash($_POST['price'] ?? 0)),'tax'=>(isset($_POST['tax']) && $_POST['tax']!=='' && !isset($_POST['default_tax']))?(float)sanitize_text_field(wp_unslash($_POST['tax'])):null,'max_purchase_quantity'=>absint(wp_unslash($_POST['max_purchase_quantity'] ?? 10)),'attendee_count'=>absint(wp_unslash($_POST['attendee_count'] ?? 1)),'active'=>(int)!empty($_POST['active']),'custom_fields'=>sanitize_text_field(wp_unslash($_POST['custom_fields'] ?? '')),'added'=>gmdate("Y-m-d H:i:s"), 'salt'=>ticketdrum_generate_password(20))
);
}
else if (isset($_POST['delete']) && check_admin_referer('ticketdrum_ticket_edit')) {
$wpdb->query($wpdb->prepare("DELETE FROM %i WHERE id = %d", TICKETDRUM_TICKETS_TABLE, $id));
} else {//selecting value to update
$tickets = $wpdb->get_results($wpdb->prepare("SELECT * from %i where id=%d", TICKETDRUM_TICKETS_TABLE, $id));
$thisticket = $tickets[0];
#print_r($thisticket);
}
$alltickets = $wpdb->get_results($wpdb->prepare("SELECT id,title,custom_fields from %i", TICKETDRUM_TICKETS_TABLE));
$all_events = $wpdb->get_results($wpdb->prepare("SELECT * FROM %i ORDER BY title ASC",TICKETDRUM_EVENTS_TABLE),ARRAY_A);
?>