Browse Source

secret api call

master
memespring 16 years ago
parent
commit
cdecddd8bd
2 changed files with 18 additions and 1 deletions
  1. +6
    -1
      docs/api.php
  2. +12
    -0
      docs/include/application.php

+ 6
- 1
docs/api.php View File

@@ -118,7 +118,12 @@ class api {
$this->applications = Applications::query_area($_GET['bottom_left_easting'], $_GET['bottom_left_northing'], $_GET['top_right_easting'], $_GET['top_right_easting']); $this->applications = Applications::query_area($_GET['bottom_left_easting'], $_GET['bottom_left_northing'], $_GET['top_right_easting'], $_GET['top_right_easting']);
} }
break; break;

case "latest":
$this->applications = Applications::query_latest(500);
break;

query_latest
default: default:
$this->warnings = "No call type specified"; $this->warnings = "No call type specified";
} }


+ 12
- 0
docs/include/application.php View File

@@ -145,6 +145,18 @@ class Applications{
return applications::load_applications($application_results); return applications::load_applications($application_results);
} }
//latest
function query_latest($count = 100) {
$db = DB::connect(DB_CONNECTION_STRING);
$sql = "select council_reference, address, postcode, description, info_url, comment_url, map_url, x, y, date_recieved, date_scraped, full_name
from application
inner join authority on application.authority_id = authority.authority_id
order by date_scraped desc limit " . $count;

$application_results = $db->getAll($sql);
return applications::load_applications($application_results);
}
function load_applications($application_results){ function load_applications($application_results){
$applications = array(); $applications = array();
if (sizeof($application_results) > 0) { if (sizeof($application_results) > 0) {


Loading…
Cancel
Save