function dbem_global_map_json($eventful = false)
{
    $json = '{"locations":[';
    $locations = dbem_get_locations($eventful);
    $json_locations = array();
    foreach ($locations as $location) {
        $json_location = array();
        foreach ($location as $key => $value) {
            $json_location[] = '"' . $key . '":"' . $value . '"';
        }
        $json_location[] = '"location_baloon":"' . dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location) . '"';
        $json_locations[] = "{" . implode(",", $json_location) . "}";
    }
    $json .= implode(",", $json_locations);
    $json .= "]}";
    echo $json;
}
Exemplo n.º 2
0
function dbem_locations_page()
{
    if (isset($_GET['action']) && $_GET['action'] == "edit") {
        // edit location
        $location_id = $_GET['location_ID'];
        $location = dbem_get_location($location_id);
        dbem_locations_edit_layout($location);
    } else {
        if (isset($_POST['action']) && $_POST['action'] == "editedlocation") {
            // location update required
            $location = array();
            $location['location_id'] = $_POST['location_ID'];
            $location['location_name'] = $_POST['location_name'];
            $location['location_address'] = $_POST['location_address'];
            $location['location_town'] = $_POST['location_town'];
            $location['location_latitude'] = $_POST['location_latitude'];
            $location['location_longitude'] = $_POST['location_longitude'];
            $location['location_description'] = $_POST['content'];
            if (empty($location['location_latitude'])) {
                $location['location_latitude'] = 0;
                $location['location_longitude'] = 0;
            }
            $validation_result = dbem_validate_location($location);
            if ($validation_result == "OK") {
                dbem_update_location($location);
                if ($_FILES['location_image']['size'] > 0) {
                    dbem_upload_location_picture($location);
                }
                $message = __('The location has been updated.', 'dbem');
                $locations = dbem_get_locations();
                dbem_locations_table_layout($locations, $message);
            } else {
                $message = $validation_result;
                dbem_locations_edit_layout($location, $message);
            }
        } elseif (isset($_POST['action']) && $_POST['action'] == "addlocation") {
            $location = array();
            $location['location_name'] = $_POST['location_name'];
            $location['location_address'] = $_POST['location_address'];
            $location['location_town'] = $_POST['location_town'];
            $location['location_latitude'] = $_POST['location_latitude'];
            $location['location_longitude'] = $_POST['location_longitude'];
            $location['location_description'] = $_POST['content'];
            $validation_result = dbem_validate_location($location);
            if ($validation_result == "OK") {
                $new_location = dbem_insert_location($location);
                // uploading the image
                if ($_FILES['location_image']['size'] > 0) {
                    dbem_upload_location_picture($new_location);
                }
                // -------------
                //RESETME $message = __('The location has been added.', 'dbem');
                $locations = dbem_get_locations();
                dbem_locations_table_layout($locations, null, $message);
            } else {
                $message = $validation_result;
                $locations = dbem_get_locations();
                dbem_locations_table_layout($locations, $location, $message);
            }
        } else {
            // no action, just a locations list
            $locations = dbem_get_locations();
            dbem_locations_table_layout($locations, $message);
        }
    }
}
Exemplo n.º 3
0
<?php

require_once '../../../wp-load.php';
$locations = dbem_get_locations();
$return = array();
foreach ($locations as $item) {
    $record = array();
    $record['id'] = $item['location_id'];
    $record['name'] = $item['location_name'];
    $record['address'] = $item['location_address'];
    $record['town'] = $item['location_town'];
    $return[] = $record;
}
$q = strtolower($_GET["q"]);
if (!$q) {
    return;
}
foreach ($return as $row) {
    if (strpos(strtolower($row['name']), $q) !== false) {
        $location = array();
        $rows = array();
        foreach ($row as $key => $value) {
            $location[] = "'{$key}' : '" . str_replace("'", "\\'", $value) . "'";
        }
        echo "{" . implode(" , ", $location) . " }\n";
    }
}
Exemplo n.º 4
0
<?php

# LOCATIONS LIST
$locations = dbem_get_locations(true);
?>

<table id="events-table">
	<col id="col120" />
    <col id="col190" />
	<?php 
$seenlocation_id = '';
$echoend = false;
foreach ($locations as $listing) {
    if ($seenlocation_id != $listing['location_id']) {
        ?>
         		<tbody>
         		<tr><th colspan="2" class="text-left">
         		<h4 class="event-date">
         		<a href="<?php 
        get_bloginfo("siteurl");
        ?>
/events/?location_id=<?php 
        echo $listing['location_id'];
        ?>
">
         			<?php 
        echo $listing['location_name'];
        ?>
</a>
         		</h4></th>
         		<th class="text-right"><?php