forked from hypercities/hypercities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexportCollectionKml.php
More file actions
65 lines (53 loc) · 1.79 KB
/
exportCollectionKml.php
File metadata and controls
65 lines (53 loc) · 1.79 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
<?php
// vim: ts=4:sw=4:nu:nospell
/**
* @file
* HyperCities query script for Collection Narrative View
*
* Return the KML file that contain all children of given collection Id
*
* @author HyperCities Tech Team
* @copyright Copyright 2008-2009, The Regents of the University of California
* @date 2009-07-18
* @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_GET = HC_sanitizeInput($_GET,
array('func'=>'str', 'cid'=>'int'),
array('cid'));
$cid = $HC_GET['cid'];
$userId = cServerSession::getUserId();
$isLogin = !empty($userId);
$isAdmin = cServerSession::isAdmin();
// Get Collection Metadata
$collectionInfo = HCCollection::getCollectionInfoById($cid, $isAdmin);
// Get Children Info of Collection $cid
$children = HCCollection::getCollectionById($cid, $isAdmin);
//HC_debugLog(var_export($children, true));
// 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']);
// 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;
?>