prefix."fare"; $wpdb->query($wpdb->prepare("UPDATE $table_name SET mile=%s,stop=%s,seat=%s,adul=%s,inf=%s,lugg=%s,minute=%s,diskmmile=%d,curr=%s,color=%s WHERE fare_id=%d",$mile,$stop,$seat,$adul,$inf,$lugg,$minute,$diskmmile,$curr,$bcolor,1)); } if (($_SERVER['REQUEST_METHOD'] == 'POST') && isset($_POST['addtaxi']) ) { $cartype=sanitize_text_field($_POST['cartype']); $carfare=sanitize_text_field($_POST['carfare']); $carfare=filter_var( $carfare, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $table_name = $wpdb->prefix."cartypes"; $wpdb->query($wpdb->prepare("INSERT INTO $table_name(name,fare) VALUES(%s,%s)",array($cartype,$carfare))); } class asi_taxibook_plugin_admin { /** verbingo_plugin father class */ private $taxi_settings_key = 'taxi_setting'; private $car_settings_key = 'asi_taxisetting'; private $booking_settings_key = 'asi_booking'; private $language_settings_key = 'asi_lang'; private $taxi_options_key = 'asi_options'; private $taxi_settings_tabs = array(); private $localleft = 'left'; function __construct() { add_action( 'init', array( &$this, 'asi_taxibook_scripts_admin')); add_action( 'init', array( &$this, 'load_taxi_settings')); add_action( 'admin_init', array( &$this, 'register_asi_taxi_settings' )); add_action( 'admin_init', array( &$this, 'register_addtaxi_settings' )); add_action( 'admin_init', array( &$this, 'register_taxibooking_settings' )); add_action( 'admin_init', array( &$this, 'register_taxilang_settings' )); add_action( 'admin_init', array( &$this, 'taxi_allselected_car' )); add_action( 'admin_init', array( &$this, 'taxi_allselected_fare' )); add_action( 'admin_menu', array( &$this, 'add_admin_menus' )); } function taxi_allselected_car() { global $wpdb; $table_name = $wpdb->prefix."cartypes"; $cartypes = $wpdb->get_results("SELECT * FROM $table_name",ARRAY_A); return $cartypes; } function taxi_allselected_fare() { global $wpdb; $table_name = $wpdb->prefix."fare"; $fares = $wpdb->get_results("SELECT * FROM $table_name",ARRAY_A); return $fares; } function asi_all_orders() { global $wpdb; $bookingt = $wpdb->prefix."Booking"; $bookings = $wpdb->get_results("SELECT * FROM $bookingt",ARRAY_A); return $bookings; } /** UTILITY FUNCTIONS * */ private function section($head, $text = '') { echo '

' . $head . '

'; echo '
'; if ($text) echo '

' . $text . '

'; } private function topsection() { echo '
'; } private function header($head) { echo '

'.$head.'

'; } function asi_taxibook_scripts_admin() { $google_map_api = 'https://maps.google.com/maps/api/js?sensor=true&libraries=places&language=en-AU'; wp_enqueue_script('google-places', $google_map_api); wp_register_style('asi_taxi_style', plugins_url('css/asi_taxibook_style.css',__FILE__)); wp_enqueue_style('asi_taxi_style'); wp_register_script('asi_taxi_script', plugins_url('js/asi_taxibook_script.js', __FILE__ ),array('jquery')); wp_enqueue_script('asi_taxi_script'); } // Load Settings function load_taxi_settings() { $this->general_settings = (array) get_option( $this->taxi_settings_key ); $this->advanced_settings = (array) get_option( $this->car_settings_key ); // Merge with defaults $this->general_settings = array_merge( array( 'general_option' => 'General value' ), $this->general_settings ); $this->advanced_settings = array_merge( array( 'advanced_option' => 'Advanced value' ), $this->advanced_settings ); } function register_asi_taxi_settings() { $this->taxi_settings_tabs[$this->taxi_settings_key] = 'Settings'; register_setting( $this->taxi_settings_key, $this->taxi_settings_key ); add_settings_section( 'section_fare', '', array( &$this, 'section_taxi_fare_desc' ), $this->taxi_settings_key ); } // Call Language Setting Page function section_taxi_fare_desc() { $fares=$this->taxi_allselected_fare(); if($fares[0]['diskmmile']==0){ $kmselected="";$milesselected="selected";}else{$milesselected="";$kmselected="selected";} $selectdistance=''; $this->section(__('Fare Settings','asi')); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Fare per mile
Fare per stop
Fare per adult seat
Fare per baby seat
Fare per infant seat
Fare per luggage
Fare per minute
Type of distance'.$selectdistance.'
Currency Type
Background color
'; echo '
'; $this->topsection(); } // Register Advance Settings function register_addtaxi_settings() { $this->taxi_settings_tabs[$this->car_settings_key] = 'Taxi Type'; register_setting( $this->car_settings_key, $this->car_settings_key ); add_settings_section( 'section_addcar', 'Add Taxi Type', array( &$this, 'section_addtaxi_desc' ), $this->car_settings_key ); } function section_addtaxi_desc() { $cartypes=$this->taxi_allselected_car(); $fares=$this->taxi_allselected_fare(); echo '
'; $i=1; echo ''; foreach($cartypes as $car) { echo ''; $i++; } echo '
S.NoCar TypeCar FeeAction
'.$i.''.$car['name'].''.$car['fare'].' '.$fares[0]['curr'].'
'; echo ''; echo ''; echo ''; echo '
Car TypeCar Fee
'; } function register_taxilang_settings() { $this->taxi_settings_tabs[$this->language_settings_key] = 'Language'; register_setting( $this->language_settings_key, $this->language_settings_key ); add_settings_section( 'section_addlang', '', array( &$this, 'section_taxilang_desc' ), $this->language_settings_key); } function section_taxilang_desc() { $this->section(__('Language Setting','asi')); $this->header(__('For more options contact us at','asi')); echo '
info1@adaptivesolutionsinc.com'; echo '
'; echo '
'; echo '
'; $this->topsection(); } function register_taxibooking_settings() { $this->taxi_settings_tabs[$this->booking_settings_key] = 'Booking'; register_setting( $this->booking_settings_key, $this->booking_settings_key ); add_settings_section( 'section_booking', 'Bookings', array( &$this, 'section_taxibooking_desc' ), $this->booking_settings_key ); } function section_taxibooking_desc() { $booking=$this->asi_all_orders(); echo '
'; $i=1; echo ''; if(empty($booking)) { echo ''; } else { foreach($booking as $order) { echo ''; $i++; } } echo '
S.NoNameEmailCellPickUpDrop OffTimeCar TypeAdultsBabyInfantsLuggageDelete
No Record Found
'.$i.''.$order['name'].''.$order['email'].''.$order['cell'].''.$order['pickup'].' '.$order['dropoff'].''.$order['date'].''.$order['cartype'].''.$order['adults'].''.$order['baby'].''.$order['infan'].''.$order['lugg'].'
Delete
'; } // Add Menu Here function add_admin_menus() { add_menu_page('asi_dashboard', 'Asi Taxi Booking', 'manage_options', $this->taxi_options_key, array( &$this, 'plugin_options_page' ),''.plugins_url("img/", __FILE__).'asiimg.png'); } function plugin_options_page() { $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->taxi_settings_key; ?>
taxi_options_tabs(); ?>
taxi_settings_key; $scren=screen_icon(); echo ''; } } add_action( 'plugins_loaded', create_function( '', '$asi_admin_side = new asi_taxibook_plugin_admin;' ) ); ?>