big update google map and calender adding feature and more

This commit is contained in:
magepeopleteam 2018-02-22 12:09:34 +00:00
parent 264da4a9ae
commit 63f62d8bd4
10 changed files with 323 additions and 85 deletions

View File

@ -31,4 +31,67 @@
.inside .sec label {
font-weight: normal;
display: block;
}
}
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 250px;
}
#infowindow-content .title {
font-weight: bold;
}
#infowindow-content {
display: none;
}
#map #infowindow-content {
display: inline;
}
.pac-card {
margin: 10px 10px 0 0;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
-moz-box-sizing: border-box;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
background-color: #fff;
font-family: Roboto;
}
#pac-container {
padding-bottom: 12px;
margin-right: 12px;
}
.pac-controls {
display: inline-block;
padding: 5px 11px;
}
.pac-controls label {
font-family: Roboto;
font-size: 13px;
font-weight: 300;
}
#pac-input {
background-color: #fff;
font-family: Roboto;
font-size: 15px;
font-weight: 300;
margin-left: 12px;
padding: 0 11px 0 13px;
text-overflow: ellipsis;
width: 400px;
}
#pac-input:focus {
border-color: #4d90fe;
}

View File

@ -4,8 +4,13 @@
}
.mep-events-wrapper {
border: 1px solid #ddd;
border: 0px solid #ddd;
padding: 0px;
max-width: 1170px;
margin: 0 auto;
}
.mep-event-detailsss {
border: 1px solid #ddd;
}
.mep-events-header {
border-bottom: 1px solid #ddd;
@ -314,7 +319,17 @@ html body .mep_event_list .mep_list_event_details a {
width: 100%;
text-align: left;
}
.mep-add-calender {
border: 1px solid #ddd;
padding: 10px 10px;
font-size: 18px;
margin: 10px 0 0 0;
display: inline-block;
}
.mep-add-calender .fa {
margin-right: 10px;
display: inline-block;
}
/* Responsive CSS
=====================================================================*/
@ -467,6 +482,4 @@ html body .mep_event_list .mep_list_event_details a {
.mep-event-datetime {
padding: 0;
}
}
}

View File

@ -14,6 +14,7 @@ function mep_event_meta_box_add(){
function mep_event_venue_meta_box_cb($post){
$values = get_post_custom( $post->ID );
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
?>
<div class='sec'>
@ -62,8 +63,129 @@ $values = get_post_custom( $post->ID );
<span><input id='mep_ev_7' type="text" name='mep_country' value='<?php echo $values['mep_country'][0]; ?>'> </span>
</div>
<?php
if($user_api){
?>
<div class='sec'>
<label for="mep_ev_989"> Show Google Map: </label>
<span><input style='text-align: left;width: auto;' id='mep_ev_989' type="checkbox" name='mep_sgm' value='1' <?php $mep_sgm = $values['mep_sgm'][0]; if($mep_sgm==1){ echo 'checked'; } ?> > Yes</span>
</div>
<div class='sec'>
<input id="pac-input" name='location_name' value='<?php //echo $values['location_name'][0]; ?>'/>
</div>
<input type="hidden" class="form-control" required name="latitude" value="<?php echo $values['latitude'][0]; ?>">
<input type="hidden" class="form-control" required name="longitude" value="<?php echo $values['longitude'][0]; ?>">
<div id="map"></div>
<?php
}else{
echo "<span class=mep_status><span class=err>No Google MAP API Key Found. Please enter API KEY <a href=".get_site_url()."/wp-admin/options-general.php?page=mep_event_settings_page>Here</a></span></span>";
}
if($values['latitude'][0]){
$lat = $values['latitude'][0];
}else{ $lat = '37.0902'; }
if($values['longitude'][0]){
$lon = $values['longitude'][0];
}else{ $lon = '95.7129'; }
?>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: <?php echo $lat; ?>,
lng: <?php echo $lon; ?>
},
zoom: 17
});
var input = /** @type {!HTMLInputElement} */ (
document.getElementById('pac-input'));
var types = document.getElementById('type-selector');
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var infowindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
map: map,
anchorPoint: new google.maps.Point(0, -29),
draggable: true,
position: {lat: <?php echo $lat; ?>, lng: <?php echo $lon; ?>}
});
google.maps.event.addListener(marker, 'dragend', function() {
document.getElementsByName('latitude')[0].value = marker.getPosition().lat();
document.getElementsByName('longitude')[0].value = marker.getPosition().lng();
})
autocomplete.addListener('place_changed', function() {
infowindow.close();
marker.setVisible(false);
var place = autocomplete.getPlace();
if (!place.geometry) {
window.alert("Autocomplete's returned place contains no geometry");
return;
}
// If the place has a geometry, then present it on a map.
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17); // Why 17? Because it looks good.
}
marker.setIcon( /** @type {google.maps.Icon} */ ({
url: 'http://maps.google.com/mapfiles/ms/icons/red.png',
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
scaledSize: new google.maps.Size(35, 35)
}));
marker.setPosition(place.geometry.location);
marker.setVisible(true);
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
var latitude = place.geometry.location.lat();
var longitude = place.geometry.location.lng();
$("input[name=coordinate]").val(address);
$("input[name=latitude]").val(latitude);
$("input[name=longitude]").val(longitude);
//infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
//infowindow.open(map, marker);
});
}
google.maps.event.addDomListener(window, "load", initMap);
</script>
<?php
}
@ -129,38 +251,50 @@ function mep_events_meta_save($post_id){
return;
}
//if you get here then it's your post type so do your thing....
$seat = strip_tags($_POST['mep_total_seat']);
$mep_location_venue = strip_tags($_POST['mep_location_venue']);
$mep_street = strip_tags($_POST['mep_street']);
$mep_city = strip_tags($_POST['mep_city']);
$mep_state = strip_tags($_POST['mep_state']);
$mep_postcode = strip_tags($_POST['mep_postcode']);
$mep_country = strip_tags($_POST['mep_country']);
$seat = strip_tags($_POST['mep_total_seat']);
$mep_location_venue = strip_tags($_POST['mep_location_venue']);
$mep_street = strip_tags($_POST['mep_street']);
$mep_city = strip_tags($_POST['mep_city']);
$mep_state = strip_tags($_POST['mep_state']);
$mep_postcode = strip_tags($_POST['mep_postcode']);
$mep_country = strip_tags($_POST['mep_country']);
$mep_price_label = strip_tags($_POST['mep_price_label']);
$mep_sqi = strip_tags($_POST['mep_sqi']);
$_price = strip_tags($_POST['_price']);
$mep_event_start_date = strip_tags($_POST['mep_event_start_date']);
$mep_sgm = strip_tags($_POST['mep_sgm']);
$_price = strip_tags($_POST['_price']);
$mep_event_start_date = strip_tags($_POST['mep_event_start_date']);
$mep_event_end_date = strip_tags($_POST['mep_event_end_date']);
$latitude = strip_tags($_POST['latitude']);
$longitude = strip_tags($_POST['longitude']);
$location_name = strip_tags($_POST['location_name']);
$update_seat = update_post_meta( $pid, 'mep_total_seat', $seat);
$update_seat_stock_status = update_post_meta( $pid, '_manage_stock', 'yes');
$update_seat_stock = update_post_meta( $pid, '_stock', $seat);
$update_seat_stock = update_post_meta( $pid, '_stock', $seat);
$sts_msg = update_post_meta( $pid, '_stock_msg', 'new');
// $ttl_booking = update_post_meta( $pid, 'total_booking', '0');
$longitude = update_post_meta( $pid, 'longitude', $longitude);
$latitude = update_post_meta( $pid, 'latitude', $latitude);
$location_name = update_post_meta( $pid, 'location_name', $location_name);
$update_location = update_post_meta( $pid, 'mep_location_venue', $mep_location_venue);
$update_location = update_post_meta( $pid, 'mep_location_venue', $mep_location_venue);
$update_mep_street = update_post_meta( $pid, 'mep_street', $mep_street);
$update_city = update_post_meta( $pid, 'mep_city', $mep_city);
$update_city = update_post_meta( $pid, 'mep_city', $mep_city);
$update_mep_state = update_post_meta( $pid, 'mep_state', $mep_state);
$update_postcode = update_post_meta( $pid, 'mep_postcode', $mep_postcode);
$update_conuntry = update_post_meta( $pid, 'mep_country', $mep_country);
$update_postcode = update_post_meta( $pid, 'mep_postcode', $mep_postcode);
$update_conuntry = update_post_meta( $pid, 'mep_country', $mep_country);
$update_sqi = update_post_meta( $pid, 'mep_sqi', $mep_sqi);
$update_mep_sgm = update_post_meta( $pid, 'mep_sgm', $mep_sgm);
$update_price_label = update_post_meta( $pid, 'mep_price_label', $mep_price_label);
$update_price = update_post_meta( $pid, '_price', $_price);
$update_start = update_post_meta( $pid, 'mep_event_start_date', $mep_event_start_date);
$update_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
$update_price = update_post_meta( $pid, '_price', $_price);
$update_start = update_post_meta( $pid, 'mep_event_start_date', $mep_event_start_date);
$update_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
}

View File

@ -3,6 +3,7 @@ function initialize() {
var hlng = parseFloat(helper.lng)||22.0000;
var myLatLng = new google.maps.LatLng(hlat,hlng);
var mapOptions = {
center: myLatLng,
zoom: 5

View File

@ -1,20 +0,0 @@
jQuery(document).ready( function() {
var kaka = jQuery('.regular_mkb_type').val();
if(kaka == 6){
jQuery(".mkb_cats").show();
}
jQuery('.regular_mkb_type').on('change', function() {
var thtype = this.value;
if(thtype == 6){
jQuery(".mkb_cats").show();
}else{
jQuery(".mkb_cats").hide();
jQuery(".regular_mkb_cats").val(0);
}
})
});

View File

@ -19,24 +19,11 @@ Features:
* Unlimited Organization
* Unlimited Event
* Open Source
* Responsive Design
* Developer Friendly
* Based on Woo-commerce
* Works with any standards compliant WordPress theme
* Plays well with other Plugins
* 100% Customizable
* Easy to modify templates
* Woocommerce Ready
* Use Shortcode [event-list] for showing all faq question. if you want to show a event list of any particular category use [event-list cat=ID].
* Live demo http://demo.wp-people.net/mage-woo-event-booking-manager-free/
== Installation ==
Upload the Mage FAQ plugin to your blog, Activate it, then use shortcode as your need).

View File

@ -6,6 +6,7 @@ global $woocommerce;
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$book_count = get_post_meta(get_the_id(),'total_booking', true);
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
?>
<div class="mep-events-wrapper">
@ -30,13 +31,44 @@ if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
<?php } else{ _e('<h3>Free</h3>','mep'); }?>
<?php if($event_meta['mep_total_seat'][0]){
?>
<h5><strong><?php _e('Total Seat:','mep'); ?></strong> <?php echo $event_meta['mep_total_seat'][0]; ?> (<strong><?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?></strong> Left)</h5>
<?php } ?>
<div class="calender-url">
<?php mep_add_to_google_calender_link(get_the_id()); ?>
</div>
</div>
</div>
</div>
<?php if($event_meta['mep_sgm'][0]){ if($user_api){?>
<div class="mep-gmap-sec">
<div id="map" class='mep_google_map'></div>
</div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: <?php echo $event_meta['latitude'][0]; ?>, lng: <?php echo $event_meta['longitude'][0]; ?>},
zoom: 17
});
marker = new google.maps.Marker({
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
position: {lat: <?php echo $event_meta['latitude'][0]; ?>, lng: <?php echo $event_meta['longitude'][0]; ?>}
});
marker.addListener('click', toggleBounce);
}
function toggleBounce() {
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&callback=initMap"
async defer></script>
<?php } } ?>
<div class="mep-btn-part">
<div class="mep-left-col">
<div class="mep-event-meta">

View File

@ -4,7 +4,7 @@ the_post();
$term_id = get_queried_object()->term_id;
// print_r(get_queried_object());
?>
<div class="mep-events-wrapper">
<div class='mep_event_list'>
<div class="mep_cat-details">
<h1><?php echo get_queried_object()->name; ?></h1>
@ -49,6 +49,7 @@ $term_id = get_queried_object()->term_id;
}
?>
</div>
</div>
<?php
get_footer();
?>

View File

@ -5,7 +5,7 @@ the_post();
$term_id = get_queried_object()->term_id;
// print_r(get_queried_object());
?>
<div class="mep-events-wrapper">
<div class='mep_event_list'>
<div class="mep_cat-details">
@ -51,7 +51,7 @@ $term_id = get_queried_object()->term_id;
}
?>
</div>
</div>
<?php
get_footer();
?>

View File

@ -1,9 +1,9 @@
<?php
/**
* Plugin Name: Mage Woo Event Booking Manager
* Plugin Name: Mage WooCommerce Event Booking Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 1.0.2
* Version: 1.0.5
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
*/
@ -13,10 +13,12 @@
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
require_once(dirname(__FILE__) . "/inc/class/mep_settings_api.php");
require_once(dirname(__FILE__) . "/inc/mep_cpt.php");
require_once(dirname(__FILE__) . "/inc/mep_tax.php");
require_once(dirname(__FILE__) . "/inc/mep_event_meta.php");
require_once(dirname(__FILE__) . "/inc/mep_shortcode.php");
require_once(dirname(__FILE__) . "/inc/admin_setting_panel.php");
@ -25,6 +27,7 @@ require_once(dirname(__FILE__) . "/inc/mep_shortcode.php");
// Enqueue Scripts for admin dashboard
add_action('admin_enqueue_scripts', 'mep_event_admin_scripts');
function mep_event_admin_scripts() {
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-timepicker-addon',plugin_dir_url( __FILE__ ).'js/jquery-ui-timepicker-addon.js',array('jquery','jquery-ui-core'),1,true);
@ -32,6 +35,11 @@ function mep_event_admin_scripts() {
wp_enqueue_style('jquery-ui-timepicker-addon',plugin_dir_url( __FILE__ ).'css/jquery-ui-timepicker-addon.css',array());
wp_enqueue_style('mep-admin-style',plugin_dir_url( __FILE__ ).'css/admin_style.css',array());
wp_enqueue_style('mep-jquery-ui-style',plugin_dir_url( __FILE__ ).'css/jquery-ui.css',array());
wp_enqueue_script('gmap-scripts',plugin_dir_url( __FILE__ ).'js/mkb-admin.js',array('jquery','jquery-ui-core'),1,true);
if($user_api){
wp_enqueue_script('gmap-libs','https://maps.googleapis.com/maps/api/js?key='.$user_api.'&libraries=places&callback=initMap',array('jquery','gmap-scripts'),1,true);
}
}
@ -298,26 +306,6 @@ function mep_event_seat_management( $order_id, $from_status, $to_status, $order
}
if( $order->has_status('on-hold')) {
update_post_meta( $event_id, $order_meta_text, $order_processing);
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
$mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
if($mep_stock_order==$order_id){
if($mep_stock_msg=='completed'){
update_post_meta( $event_id, $order_meta_text, $order_processing);
}
else{
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
update_post_meta( $event_id, $order_meta_text, $order_processing);
}
}
}
if($order->has_status( 'cancelled' )) {
update_post_meta( $event_id, $order_meta_text, $order_cancelled);
@ -462,7 +450,7 @@ function mep_get_event_status($startdatetime){
$datetime1 = new DateTime();
$datetime2 = new DateTime($newformat);
$interval = $datetime1->diff($datetime2);
// print_r($newformat);
if(time() > strtotime($newformat)){
return "<span class=err>Expired</span>";
}
@ -677,4 +665,43 @@ function mep_social_share(){
<li><a data-toggle="tooltip" title="" class="twitter" onclick="window.open('https_ssl_verify://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title(); ?>','Twitter share','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title(); ?>" data-original-title="Twittet it"><i class="fa fa-twitter"></i></a></li>
</ul>
<?php
}
function mep_calender_date($datetime){
$time = strtotime($datetime);
$newdate = date('Ymd',$time);
$newtime = date('Hi',$time);
$newformat = $newdate."T".$newtime."00Z";
return $newformat;
}
function mep_add_to_google_calender_link($pid){
$event = get_post($pid);
$event_meta = get_post_custom($pid);
$event_start = $event_meta['mep_event_start_date'][0];
$event_end = $event_meta['mep_event_end_date'][0];
$location = $event_meta['mep_location_venue'][0]." ".$event_meta['mep_street'][0]." ".$event_meta['mep_city'][0]." ".$event_meta['mep_state'][0]." ".$event_meta['mep_postcode'][0]." ".$event_meta['mep_country'][0];
ob_start();
?>
<a href="http://www.google.com/calendar/event?
action=TEMPLATE
&text=<?php echo $event->post_title; ?>
&dates=<?php echo mep_calender_date($event_start); ?>/<?php echo mep_calender_date($event_end); ?>
&details=<?php echo $event->post_content; ?>
&location=<?php echo $location; ?>
&trp=false
&sprop=
&sprop=name:"
target="_blank" class='mep-add-calender' rel="nofollow"> <i class="fa fa-calendar"></i> Add To Your Calendar</a>
<?php
$content = ob_get_clean();
echo $content;
}