Automatically exported from code.google.com/p/planningalerts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.6 KiB

  1. <?php
  2. //Includes
  3. require_once('config.php');
  4. require_once('application.php');
  5. require_once('scraper_support.php');
  6. //build date url
  7. $current_date = getdate();
  8. $day = $current_date['mday'] -5;
  9. $month = $current_date['mon'];
  10. $year = $current_date['year'];
  11. //if any get params were passed, overwrite the default date
  12. if (isset($_GET['day'])){
  13. $day = $_GET['day'];
  14. }
  15. if (isset($_GET['month'])){
  16. $month = $_GET['month'];
  17. }
  18. if (isset($_GET['year'])){
  19. $year = $_GET['year'];
  20. }
  21. //search url
  22. $search_url = "http://www.cambridge.gov.uk/publicaccess/tdc/DcApplication/application_searchresults.aspx?searchtype=WEEKLY&selWeeklyListRange=#daterange&weektype=VAL";
  23. $date_range = "{$day}%2F{$month}%2F{$year}%7C{$day}%2F{$month}%2F{$year}";
  24. $search_url = str_replace("#daterange", $date_range, $search_url);
  25. //comment and info urls
  26. $info_url_base = "http://www.cambridge.gov.uk/publicaccess/tdc/DcApplication/application_detailview.aspx?caseno=";
  27. $comment_url_base = "http://www.cambridge.gov.uk/publicaccess/tdc/DcApplication/application_comments_entryform.aspx?caseno=";
  28. //grab urls
  29. $applications = scrape_applications_publicaccess($search_url, $info_url_base, $comment_url_base);
  30. //smarty
  31. $smarty = new Smarty;
  32. $smarty->force_compile = true;
  33. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  34. $smarty->template_dir = "../templates";
  35. $smarty->assign("authority_name", "Cambridge City Council");
  36. $smarty->assign("authority_short_name", "Cambridge");
  37. if (sizeof($applications) > 0){
  38. $smarty->assign("applications", $applications);
  39. }
  40. $smarty->display("xml.tpl");
  41. ?>