コード例 #1
0
ファイル: BitGmap.php プロジェクト: bitweaver/gmap
 /**
  * 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);
 }
コード例 #2
0
ファイル: edit_polyline.php プロジェクト: bitweaver/gmap
// Now check permissions to access the polyline
if ($gContent->isValid()) {
    if (!$gContent->hasUpdatePermission()) {
        $gBitSystem->fatalError(tra("Sorry, you do not have permission to edit this polyline."));
    }
} else {
    $gContent->verifyCreatePermission();
    /* if we are passed a set_id the user is trying to add an overlay to a set.
    	   if they dont have the right, then f**k it.
    	   in the future it might be nice to send this back as an alert to display 
    	   so that the form does not get erased and their work is not lost, but this 
    	   should prevent the form from even loading. -wjames5
    	*/
    if (isset($_REQUEST['set_id'])) {
        require_once GMAP_PKG_PATH . 'BitGmapPolylineSet.php';
        $set = new BitGmapPolylineSet($_REQUEST['set_id']);
        $set->load();
        if ($set->isValid() && !$set->hasUserPermission('p_gmap_attach_children')) {
            $gBitSystem->fatalError(tra("You can not add polylines to this polyline set!"));
            die;
        }
    }
}
//Preview mode is handled by javascript on the client side.
//There is no callback to the server for previewing changes.
//most of the time we want xml back so we make it the default
$format = 'xml';
$XMLContent = "";
$statusCode = 401;
if (!empty($_REQUEST["save_polyline"])) {
    $gBitUser->verifyTicket();
コード例 #3
0
 * 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 . 'BitGmapPolylineSet.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['set_id']) && is_numeric($_REQUEST['set_id'])) {
        // if sample_id supplied, use that
        $gContent = new BitGmapPolylineSet($_REQUEST['set_id']);
    } elseif (!empty($_REQUEST['content_id']) && is_numeric($_REQUEST['content_id'])) {
        // if content_id supplied, use that
        $gContent = new BitGmapPolylineSet(NULL, $_REQUEST['content_id']);
    } else {
        // otherwise create new object
        $gContent = new BitGmapPolylineSet();
    }
    if (empty($_REQUEST['gmap_id']) || !is_numeric($_REQUEST['gmap_id'])) {
        $_REQUEST['gmap_id'] = NULL;
    }
    $gContent->load($_REQUEST['gmap_id']);
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}