Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2011
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. <?php
  2. if(!defined('BASEPATH'))
  3. exit('No direct script access allowed');
  4. class Manifest extends CI_Controller {
  5. function __construct() {
  6. parent::__construct();
  7. $this -> load -> helper('url');
  8. $this -> load -> library('map_info');
  9. }
  10. function index(){}
  11. function view() {
  12. //if(isset($_GET['map']) && isset($_GET['lang'])) {
  13. if($this -> uri -> segment(3) != FALSE) {
  14. header('Content-Type: text/cache-manifest');
  15. echo "CACHE MANIFEST\n";
  16. echo "CACHE:\n";
  17. $mapID = $this -> uri -> segment(3);
  18. $langID = $this -> uri -> segment(4);
  19. ?>
  20. <?=base_url()?>assets/js/jquerymobile/jquery.mobile-1.0b1.css
  21. <?=base_url()?>assets/js/jquery/jquery.js
  22. <?=base_url()?>assets/js/jquerymobile/jquery.mobile-1.0b1.min.js
  23. <?=base_url()?>assets/js/leaflet/leaflet.css
  24. <?=base_url()?>assets/js/leaflet/leaflet.js
  25. <?=base_url()?>assets/js/leaflet/images/marker.png
  26. <?=base_url()?>assets/js/leaflet/images/marker-shadow.png
  27. <?=base_url()?>assets/images/layout/user.png
  28. <?=base_url()?>assets/images/layout/user-bw.png
  29. <?=base_url()?>assets/images/layout/home.png
  30. <?=base_url()?>assets/images/layout/home-bw.png
  31. <?=base_url()?>assets/images/layout/poi-icon.png
  32. <?=base_url()?>assets/js/tinysort/jquery.tinysort.min.js
  33. <?=base_url()?>assets/js/photoswipe/simple-inheritance.min.js
  34. <?=base_url()?>assets/js/photoswipe/code-photoswipe-jQuery-1.0.19.min.js
  35. <?=base_url()?>assets/js/photoswipe/photoswipe.css
  36. <?=base_url()?>assets/js/photoswipe/photoswipe-icons.png
  37. <?=base_url()?>assets/js/photoswipe/photoswipe-loader.gif
  38. <?=base_url()?>assets/images/layout/arrow-left-icon.png
  39. <?=base_url()?>assets/images/layout/arrow-up-icon.png
  40. <?=base_url()?>assets/images/layout/bullet-2-icon.png
  41. <?=base_url()?>index.php/view/map/<?=$mapID?>/<?=$langID?>
  42.  
  43. <?=base_url()?>index.php/manifest/view/<?=$mapID?>/<?=$langID?>
  44.  
  45. <?php
  46. //$this -> load -> view('manifest'); not needed, we can perform everything here.
  47. // the manifest needs to know:
  48. // 1. Required map tiles
  49. // 2. the html / php file
  50. // 3. the media files
  51. // 4. the script and css files
  52. // The manifest will calculate these using the required parameters
  53. // map id, desired language
  54.  
  55. $this -> map_info -> initialize($mapID);
  56. $this -> map_info -> mapBounding();
  57. $this -> map_info -> mapTiles($this->map_info->zoom);
  58. $this -> map_info -> poiHtml($langID);
  59. // echo all the POI media files
  60. foreach($this->map_info->poiDataArray as $poiObject){
  61. foreach($poiObject->image as $mediaFile){
  62. echo base_url().$mediaFile->source."\n";
  63. }
  64. }
  65. foreach($this->map_info->tileArray as $tile){
  66. $url = $this->map_info->tileUrl;
  67. $placeholders = array('{z}', '{x}', '{y}');
  68. $replacewith = array($tile->z, $tile->x, $tile->y);
  69. echo str_replace($placeholders, $replacewith, $url)."\n";
  70. //echo "http://a.tile.cloudmade.com/84b255854c18417b8641e17eb887c074/997/256/".$tile.".png\n";
  71. }
  72. echo "NETWORK:\n";
  73. echo "*\n";
  74. }
  75. }
  76. }
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement