-
Notifications
You must be signed in to change notification settings - Fork 1
/
view_overlayset.php
89 lines (79 loc) · 2.8 KB
/
view_overlayset.php
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
81
82
83
84
85
86
87
88
89
<?php
/**
* @version $Header$
*
* Copyright (c) 2007 bitweaver.org
* All Rights Reserved. See below for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
* @author Will <will@tekimaki.com>
*
* @package gmap
* @subpackage functions
*/
/**
* required setup
*/
require_once('../kernel/setup_inc.php' );
// Is package installed and enabled
$gBitSystem->verifyPackage('gmap' );
/**
* figure out which type of overlay set we're looking up
* sets can not be looked up by content_id only by <type>set_id
*/
$type = NULL;
if( !empty( $_REQUEST['markerset_id'] ) ){
$_REQUEST['set_id'] = $_REQUEST['markerset_id'];
$type = "marker";
}elseif( !empty( $_REQUEST['polylineset_id'] ) ){
$_REQUEST['set_id'] = $_REQUEST['polylineset_id'];
$type = "polyline";
}elseif( !empty( $_REQUEST['polygonset_id'] ) ){
$_REQUEST['set_id'] = $_REQUEST['polygonset_id'];
$type = "polygon";
}else{
// no set id we fatal
$gBitSystem->fatalError( "A valid overlay set id was not requested." );
}
// Get the overlayset for specified overylay set_id
require_once(GMAP_PKG_PATH.'lookup_'.$type.'set_inc.php' );
// Verify we have permission to view this set
$gContent->verifyViewPermission();
// If after all that we still dont have a valid set we fatal
if( !$gContent->isValid() ) {
$gBitSystem->setHttpStatus( 404 );
$gBitSystem->fatalError( "The set you requested could not be found." );
}
// We have a valid set proceed...
// Call display services
$displayHash = array( 'perm_name' => 'p_gmap_overlayset_view' );
$gContent->invokeServices( 'content_display_function', $displayHash );
// Get attached overlays in this set
// get handler class
switch( $type ){
case "marker":
require_once( GMAP_PKG_PATH.'BitGmapMarker.php' );
$overlay = new BitGmapMarker();
// this is idiotic, classes need to have plural version
$overlayTypePlural = tra("Markers");
break;
case "polyline":
require_once( GMAP_PKG_PATH.'BitGmapPolyline.php' );
$overlay = new BitGmapPolyline();
$overlayTypePlural = tra("Polylines");
break;
case "polygon":
require_once( GMAP_PKG_PATH.'BitGmapPolygon.php' );
$overlay = new BitGmapPolygon();
$overlayTypePlural = tra("Polygons");
break;
}
// get the list of attached overlays
$joinHash = array('set_id' => $gContent->mOverlaySetId, 'max_records' => 9999, 'sort_mode' => 'pos_asc');
$overlayList = $overlay->getList( $joinHash );
$gContent->mOverlays = $overlayList['data'];
$gBitSmarty->assign_by_ref( 'list', $gContent->mOverlays );
$gBitSmarty->assign_by_ref( 'overlayTypePlural', $overlayTypePlural );
// display the list
$browserTitle = $gContent->getTitle();
$displayOptions = array( 'display_mode' => 'list' );
$gBitSystem->display('bitpackage:gmap/view_overlayset.tpl', $browserTitle, $displayOptions );