* @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 <*****@*****.**> * * @package gmap * @subpackage functions */ /** * required setup */ global $gContent; require_once GMAP_PKG_PATH . 'BitGmapPolygon.php'; require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php'; // if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up. if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) { if (!empty($_REQUEST['polygon_id']) && is_numeric($_REQUEST['polygon_id'])) { // if sample_id supplied, use that $gContent = new BitGmapPolygon($_REQUEST['polygon_id']); } elseif (!empty($_REQUEST['content_id']) && is_numeric($_REQUEST['content_id'])) { // if content_id supplied, use that $gContent = new BitGmapPolygon(NULL, $_REQUEST['content_id']); } else { // otherwise create new object $gContent = new BitGmapPolygon(); } $gContent->load(); $gBitSmarty->assign_by_ref("gContent", $gContent); }
/** * Load the data from the database * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash **/ function load($pFull = TRUE) { if (!empty($this->mGmapId) || !empty($this->mContentId)) { $lookupColumn = !empty($this->mGmapId) ? 'gmap_id' : 'content_id'; $bindVars = array(); $selectSql = ''; $joinSql = ''; $whereSql = ''; array_push($bindVars, $lookupId = @BitBase::verifyId($this->mGmapId) ? $this->mGmapId : $this->mContentId); $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars); $query = "select bm.*, lc.*, lcds.`data` AS `summary`,\n\t\t\t\t\t uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\t uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name {$selectSql}\n\t\t\t\t\t FROM `" . BIT_DB_PREFIX . "gmaps` bm\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = bm.`content_id`) {$joinSql}\n\t\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t WHERE bm.`{$lookupColumn}`=? {$whereSql}"; $result = $this->mDb->query($query, $bindVars); if ($result && $result->numRows()) { $this->mInfo = $result->fields; $this->mGmapId = $result->fields['gmap_id']; $this->mContentId = $result->fields['content_id']; $this->mInfo['display_url'] = $this->getDisplayUrl(); $this->mInfo['raw'] = $this->mInfo['data']; $this->mInfo['xml_parsed_data'] = $this->parseData($this->mInfo['data'], $this->mInfo['format_guid']); $this->mInfo['parsed_data'] = $this->parseData($this->mInfo['data'], $this->mInfo['format_guid']); $this->mInfo['clean_data'] = $this->mInfo['parsed_data']; $this->mInfo['parsed_data'] = addslashes($this->mInfo['parsed_data']); $this->mInfo['xml_data'] = str_replace("\n", " ", $this->mInfo['data']); $this->mInfo['data'] = addslashes($this->mInfo['data']); $this->mInfo['data'] = str_replace("\n", "\\n", $this->mInfo['data']); parent::load(); if ($pFull) { $this->mMapTypes = $this->getMapTypes($lookupId); $this->mTilelayers = $this->getTilelayers($lookupId); $this->mCopyrights = $this->getCopyrights($lookupId); //@TODO should prolly find a better way to deal with large numbers of markers - like when +1000 $joinHash = array('gmap_id' => $this->mGmapId, 'max_records' => 9999, 'sort_mode' => 'pos_asc'); require_once GMAP_PKG_PATH . 'BitGmapMarker.php'; $marker = new BitGmapMarker(); $markersList = $marker->getList($joinHash); $this->mMapMarkers = $markersList['data']; require_once GMAP_PKG_PATH . 'BitGmapMarkerSet.php'; $markerSet = new BitGmapMarkerSet(); $markerSetsList = $markerSet->getList($joinHash); $this->mMapMarkerSets = $markerSetsList['data']; $this->mMapMarkerStyles = $this->getMarkerStyles($lookupId); $this->mMapIconStyles = $this->getIconStyles($lookupId); require_once GMAP_PKG_PATH . 'BitGmapPolyline.php'; $polyline = new BitGmapPolyline(); $polylinesList = $polyline->getList($joinHash); $this->mMapPolylines = $polylinesList['data']; require_once GMAP_PKG_PATH . 'BitGmapPolylineSet.php'; $polylineSet = new BitGmapPolylineSet(); $polylineSetsList = $polylineSet->getList($joinHash); $this->mMapPolylineSets = $polylineSetsList['data']; $lineListHash = array('gmap_id' => $lookupId); $this->mMapPolylineStyles = $this->getPolylineStyles($lineListHash); require_once GMAP_PKG_PATH . 'BitGmapPolygon.php'; $polygon = new BitGmapPolygon(); $polygonsList = $polygon->getList($joinHash); $this->mMapPolygons = $polygonsList['data']; require_once GMAP_PKG_PATH . 'BitGmapPolygonSet.php'; $polygonSet = new BitGmapPolygonSet(); $polygonSetsList = $polygonSet->getList($joinHash); $this->mMapPolygonSets = $polygonSetsList['data']; $polyListHash = array('gmap_id' => $lookupId); $this->mMapPolygonStyles = $this->getPolygonStyles($polyListHash); } } } return count($this->mInfo); }
$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);