function dbem_duplicate_event($event_ID) { global $wpdb, $EZSQL_ERROR; //First, duplicate. $event_table_name = $wpdb->prefix . EVENTS_TBNAME; $eventArray = $wpdb->get_row("SELECT * FROM {$event_table_name} WHERE event_id={$event_ID}", ARRAY_A); unset($eventArray['event_id']); $result = $wpdb->insert($event_table_name, $eventArray); if ($result !== false) { //Get the ID of the new item $event_ID = $wpdb->insert_id; $event = dbem_get_event($event_ID); $event['event_id'] = $event_ID; //Now we edit the duplicated item $title = __("Edit Event", 'dbem') . " '" . $event['event_name'] . "'"; echo "<div id='message' class='updated below-h2'>You are now editing the duplicated event.</div>"; dbem_event_form($event, $title, $event_ID); } else { echo "<div class='error'><p>There was an error duplicating the event. Try again maybe? Here are the errors:</p>"; foreach ($EZSQL_ERROR as $errorArray) { echo "<p>{$errorArray['error_str']}</p>"; } echo "</div>"; $scope = $_GET['scope']; $offset = $_GET['offset']; $order = $_GET['order']; $limit = 20; $events = dbem_get_events($limit, $scope, $order, $offset); dbem_events_table($events, $limit, $title); } }
function dbem_admin_map_script() { if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '' || isset($_REQUEST['page']) && $_REQUEST['page'] == 'locations' || isset($_REQUEST['page']) && $_REQUEST['page'] == 'new_event' || isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit_recurrence') { if (!(isset($_REQUEST['action']) && $_REQUEST['action'] == 'dbem_delete')) { // single event page $event_ID = $_REQUEST['event_id']; $event = dbem_get_event($event_ID); if ($event['location_town'] != '' || isset($_REQUEST['page']) && ($_REQUEST['page'] = 'locations')) { $gmap_key = get_option('dbem_gmap_key'); if ($event['location_address'] != "") { $search_key = $event['location_address'] . ", " . $event['location_town']; } else { $search_key = $event['location_name'] . ", " . $event['location_town']; } ?> <style type="text/css"> /* div#location_town, div#location_address, div#location_name { width: 480px; } table.form-table { width: 50%; } */ </style> <script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $gmap_key; ?> " type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ $j=jQuery.noConflict(); function loadMap(location, town, address) { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("event-map")); // map.addControl(new GScaleControl()); //map.setCenter(new GLatLng(37.4419, -122.1419), 13); var geocoder = new GClientGeocoder(); if (address !="") { searchKey = address + ", " + town; } else { searchKey = location + ", " + town; } var search = "<?php echo $search_key; ?> " ; geocoder.getLatLng( searchKey, function(point) { if (!point) { $j("#event-map").hide(); $j('#map-not-found').show(); } else { mapCenter= new GLatLng(point.lat()+0.01, point.lng()+0.005); map.setCenter(mapCenter, 13); var marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml('<strong>' + location +'</strong><p>' + address + '</p><p>' + town + '</p>'); $j('input#location-latitude').val(point.y); $j('input#location-longitude').val(point.x); $j("#event-map").show(); $j('#map-not-found').hide(); } } ); // map.addControl(new GSmallMapControl()); // map.addControl(new GMapTypeControl()); } } $j(document).ready(function() { eventLocation = $j("input#location-name").val(); eventTown = $j("input#location-town").val(); eventAddress = $j("input#location-address").val(); loadMap(eventLocation, eventTown, eventAddress); $j("input#location-name").blur(function(){ newEventLocation = $j("input#location-name").val(); if (newEventLocation !=eventLocation) { loadMap(newEventLocation, eventTown, eventAddress); eventLocation = newEventLocation; } }); $j("input#location-town").blur(function(){ newEventTown = $j("input#location-town").val(); if (newEventTown !=eventTown) { loadMap(eventLocation, newEventTown, eventAddress); eventTown = newEventTown; } }); $j("input#location-address").blur(function(){ newEventAddress = $j("input#location-address").val(); if (newEventAddress != eventAddress) { loadMap(eventLocation, eventTown, newEventAddress); eventAddress = newEventAddress; } }); }); $j(document).unload(function() { GUnload(); }); //]]> </script> <?php } } } }
<?php $event = $_GET['event_id']; $single_event = dbem_get_event($event); extract($single_event); $start_date = date("l j F, Y", strtotime($event_start_date)); ?> <h2 class="single-event-title"><?php echo $event_name; ?> </h2> <div class="single-event-stuff"> <div class="single-event-left"> <span class="single-event-date"><?php echo $start_date; ?> </span> <br /> <?php echo $event_start_12h_time . ' - '; if ($event_end_12h_time) { echo $event_end_12h_time; } ?> <br /> <div class="single-event-location"> <div class="single-event-morestuff">Location: <a href="#">Map</a> <a href="#">Weather</a></div> <?php echo $location_name . '<br />' . $location_address . '<br />' . $location_town; ?>
function dbem_is_event_rsvpable() { if (dbem_is_single_event_page()) { $event = dbem_get_event($_GET['event_id']); if ($event) { return $event['event_rsvp']; } } return 0; }
function dbem_printable_booking_report($event_id) { $event = dbem_get_event($event_id); $bookings = dbem_get_bookings_for($event_id); $available_seats = dbem_get_available_seats($event_id); $booked_seats = dbem_get_booked_seats($event_id); $stylesheet = get_bloginfo('url') . "/wp-content/plugins/events-manager/events_manager.css"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Bookings for <?php echo $event['event_name']; ?> </title> <link rel="stylesheet" href="<?php echo $stylesheet; ?> " type="text/css" media="screen" /> </head> <body id="printable"> <div id="container"> <h1>Bookings for <?php echo $event['event_name']; ?> </h1> <p><?php echo dbem_replace_placeholders("#d #M #Y", $event); ?> </p> <p><?php echo dbem_replace_placeholders("#_LOCATION, #_ADDRESS, #_TOWN", $event); ?> </p> <h2><?php _e('Bookings data', 'dbem'); ?> </h2> <table id="bookings-table"> <tr> <th scope='col'><?php _e('Name', 'dbem'); ?> </th> <th scope='col'><?php _e('E-mail', 'dbem'); ?> </th> <th scope='col'><?php _e('Phone number', 'dbem'); ?> </th> <th scope='col'><?php _e('Seats', 'dbem'); ?> </th> <?php foreach ($bookings as $booking) { ?> <tr> <td><?php echo $booking['person_name']; ?> </td> <td><?php echo $booking['person_email']; ?> </td> <td><?php echo $booking['person_phone']; ?> </td> <td class='seats-number'><?php echo $booking['booking_seats']; ?> </td> </tr> <?php } ?> <tr id='booked-seats'> <td colspan='2'> </td> <td class='total-label'><?php _e('Booked', 'dbem'); ?> :</td> <td class='seats-number'><?php echo $booked_seats; ?> </td> </tr> <tr id='available-seats'> <td colspan='2'> </td> <td class='total-label'><?php _e('Available', 'dbem'); ?> :</td> <td class='seats-number'><?php echo $available_seats; ?> </td> </tr> </table> </div> </body> </html> <?php die; }