Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!defined('BASEPATH'))
- exit('No direct script access allowed');
- class Manifest extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this -> load -> helper('url');
- $this -> load -> library('map_info');
- }
- function index(){}
- function view() {
- //if(isset($_GET['map']) && isset($_GET['lang'])) {
- if($this -> uri -> segment(3) != FALSE) {
- header('Content-Type: text/cache-manifest');
- echo "CACHE MANIFEST\n";
- echo "CACHE:\n";
- $mapID = $this -> uri -> segment(3);
- $langID = $this -> uri -> segment(4);
- ?>
- <?=base_url()?>assets/js/jquerymobile/jquery.mobile-1.0b1.css
- <?=base_url()?>assets/js/jquery/jquery.js
- <?=base_url()?>assets/js/jquerymobile/jquery.mobile-1.0b1.min.js
- <?=base_url()?>assets/js/leaflet/leaflet.css
- <?=base_url()?>assets/js/leaflet/leaflet.js
- <?=base_url()?>assets/js/leaflet/images/marker.png
- <?=base_url()?>assets/js/leaflet/images/marker-shadow.png
- <?=base_url()?>assets/images/layout/user.png
- <?=base_url()?>assets/images/layout/user-bw.png
- <?=base_url()?>assets/images/layout/home.png
- <?=base_url()?>assets/images/layout/home-bw.png
- <?=base_url()?>assets/images/layout/poi-icon.png
- <?=base_url()?>assets/js/tinysort/jquery.tinysort.min.js
- <?=base_url()?>assets/js/photoswipe/simple-inheritance.min.js
- <?=base_url()?>assets/js/photoswipe/code-photoswipe-jQuery-1.0.19.min.js
- <?=base_url()?>assets/js/photoswipe/photoswipe.css
- <?=base_url()?>assets/js/photoswipe/photoswipe-icons.png
- <?=base_url()?>assets/js/photoswipe/photoswipe-loader.gif
- <?=base_url()?>assets/images/layout/arrow-left-icon.png
- <?=base_url()?>assets/images/layout/arrow-up-icon.png
- <?=base_url()?>assets/images/layout/bullet-2-icon.png
- <?=base_url()?>index.php/view/map/<?=$mapID?>/<?=$langID?>
- <?=base_url()?>index.php/manifest/view/<?=$mapID?>/<?=$langID?>
- <?php
- //$this -> load -> view('manifest'); not needed, we can perform everything here.
- // the manifest needs to know:
- // 1. Required map tiles
- // 2. the html / php file
- // 3. the media files
- // 4. the script and css files
- // The manifest will calculate these using the required parameters
- // map id, desired language
- $this -> map_info -> initialize($mapID);
- $this -> map_info -> mapBounding();
- $this -> map_info -> mapTiles($this->map_info->zoom);
- $this -> map_info -> poiHtml($langID);
- // echo all the POI media files
- foreach($this->map_info->poiDataArray as $poiObject){
- foreach($poiObject->image as $mediaFile){
- echo base_url().$mediaFile->source."\n";
- }
- }
- foreach($this->map_info->tileArray as $tile){
- $url = $this->map_info->tileUrl;
- $placeholders = array('{z}', '{x}', '{y}');
- $replacewith = array($tile->z, $tile->x, $tile->y);
- echo str_replace($placeholders, $replacewith, $url)."\n";
- //echo "http://a.tile.cloudmade.com/84b255854c18417b8641e17eb887c074/997/256/".$tile.".png\n";
- }
- echo "NETWORK:\n";
- echo "*\n";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement