forked from hypercities/hypercities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetCollection.php
More file actions
80 lines (68 loc) · 2.52 KB
/
getCollection.php
File metadata and controls
80 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
// vim: ts=4:sw=4:nu:nospell
/**
* @file
* HyperCities query script for Collection.
*
* Return the KML file that contain all children of given collection Id
* in View and Timespan
*
* @author HyperCities Tech Team
* @copyright Copyright 2008-2009, The Regents of the University of California
* @date 2009-06-28
* @version $Id$
*
*/
include_once('includes/dbUtil.inc');
include_once('includes/HCCollection.inc');
include_once('includes/HCKmlDocument.inc');
include_once('includes/serverSession.inc');
cServerSession::start();
HC_checkReferer();
$HC_POST = HC_sanitizeInput($_POST,
array('func'=>'str', 'cid'=>'int', 'dateFrom'=>'dtime', 'dateTo'=>'dtime',
'dateFromIsBC'=>'int', 'dateToIsBC'=>'int', 'zoom'=>'int',
'swLat'=>'float', 'swLng'=>'float', 'neLat'=>'float', 'neLng'=>'float',),
array('func', 'cid', 'swLat', 'swLng', 'neLat', 'neLng', 'zoom',
'dateFrom', 'dateTo', 'dateFromIsBC', 'dateToIsBC'));
$cid = $HC_POST['cid'];
$neLat = $HC_POST['neLat'];
$neLng = $HC_POST['neLng'];
$swLat = $HC_POST['swLat'];
$swLng = $HC_POST['swLng'];
$dateFromIsBC = $HC_POST['dateFromIsBC'];
$dateFrom = $HC_POST['dateFrom'];
$dateToIsBC = $HC_POST['dateToIsBC'];
$dateTo = $HC_POST['dateTo'];
$userId = cServerSession::getUserId();
$isLogin = !empty($userId);
$isAdmin = cServerSession::isAdmin();
// Get Collection Metadata
$collectionInfo = HCCollection::getCollectionInfoById($cid, $isAdmin);
// Get Children Info of Collection $cid in bound timespan and view
$children = HCCollection::getCollectionByIdBound($cid,
$swLat, $swLng, $neLat, $neLng,
$dateFromIsBC, $dateFrom, $dateToIsBC, $dateTo, $isAdmin);
// Create HyperCities KML Document
$dom = new HCKmlDocument();
// Set Collection Metadata
$dom->setMetadata($dom->docNode, $cid,
$collectionInfo['object_state_id'],
$collectionInfo['title'],
$collectionInfo['creator'],
NULL,
$collectionInfo['description'],
$collectionInfo['date_from'], $collectionInfo['dateFrom_isBC'],
$collectionInfo['date_to'], $collectionInfo['dateTo_isBC'],
$collectionInfo['sw_lon'], $collectionInfo['sw_lat'],
$collectionInfo['ne_lon'], $collectionInfo['ne_lat'],
"collection", $collectionInfo['owner_id'],
$collectionInfo['view'], $collectionInfo['zoom']);
// Create Dom for collections
$dom->addCollections($dom->docNode, $children);
// Output Final KML Files
$dom->formatOutput = true;
$collection_xml = $dom->saveXML($dom->documentElement);
header('Content-type: application/xml');
echo $collection_xml;
?>