Setting tag plewww-5.2-2
[plewww.git] / planetlab / pub / sites.php
1 <?php
2 //
3 // Site list
4 //
5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2006 The Trustees of Princeton University
7 //
8 // $Id$ $
9 //
10
11 // Get API handle
12 require_once 'plc_session.php';
13 global $adm;
14
15 // Print header
16 require_once 'plc_drupal.php';
17 drupal_set_title('Sites');
18 include 'plc_header.php';
19
20 ?>
21
22
23 <div id='public_sites'>
24 <p>The following sites currently host or plan to host <?php echo PLC_NAME; ?> nodes.</p>
25
26 <p> Also available for download in <a href="/sites/sites.kml">KML format for Google Earth.</a> </p> 
27 </div>
28
29 <?php
30 require_once 'plc_functions.php';
31 require_once 'plc_peers.php';
32 require_once 'table.php';
33
34 $headers = array();
35 $headers['Peer']='string';
36 $headers['Name']='string';
37 $headers['Lon']='float';
38 $headers['Lat']='float';
39
40 $table=new PlekitTable ("sites",$headers,1,array('pagesize'=>10000,'pagesize_area'=>false));
41 $table->start();
42
43 $peers=new Peers($adm);
44
45 // All defined sites
46 $sites = $adm->GetSites(array('is_public' => TRUE), 
47                         array('peer_id','name', 'url','latitude','longitude'));
48
49
50 foreach ($sites as $site) {
51   $name = htmlspecialchars($site['name']);
52   $url = $site['url'];
53
54   $table->row_start();
55   $peers->cell($table,$site['peer_id']);
56   if ($url) 
57     $table->cell(href($url,$name));
58   else
59     $table->cell($name);
60   $table->cell($site['longitude']);
61   $table->cell($site['latitude']);
62   $table->row_end();
63 }
64 $table->end();
65
66 include 'plc_footer.php';
67
68 ?>