[Mapbender-commits] r1970 - branches/2.5/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jan 16 06:16:19 EST 2008
Author: christoph
Date: 2008-01-16 06:16:19 -0500 (Wed, 16 Jan 2008)
New Revision: 1970
Modified:
branches/2.5/http/classes/class_wmc.php
Log:
prepared statements
documentation
Modified: branches/2.5/http/classes/class_wmc.php
===================================================================
--- branches/2.5/http/classes/class_wmc.php 2008-01-16 10:56:53 UTC (rev 1969)
+++ branches/2.5/http/classes/class_wmc.php 2008-01-16 11:16:19 UTC (rev 1970)
@@ -39,6 +39,10 @@
if($c>0)return substr($s,$c+1);
return $s;
}
+
+/**
+ * Implementation of a Web Map Context Document, WMC 1.1.0
+ */
class wmc {
var $xml;
@@ -136,6 +140,11 @@
function wmc() {
}
+/**
+ * Saves the current WMC in the log folder.
+ *
+ * @return string the filename of the WMC document.
+ */
function saveAsFile() {
$filename = "wmc_" . date("Y_m_d_H_i_s") . ".log";
$logfile = "../../log/" . $filename;
@@ -151,14 +160,29 @@
return $filename;
}
+/**
+ * @return string the title of the WMC.
+ */
function getTitle() {
return $this->wmc_title;
}
+/**
+ * @return Integer the number of (unique?) WMS contained in this WMC.
+ */
function getNumberOfWms () {
return $this->wmc_wms_count;
}
+/**
+ * Creates a WMC object from a JS map object {@see map.js}
+ *
+ * @param object $mapObject a map object
+ * @param integer $user_id the ID of the current user
+ * @param string $generalTitle the desired title of the WMC
+ * @param object $extensionData data exclusive to Mapbender, which will be
+ * mapped into the extension part of the WMC
+ */
function createWMCFromObj($mapObject, $user_id, $generalTitle, $extensionData) {
$this->wmc_id = $user_id . '_' . time();
@@ -630,19 +654,31 @@
}
}
+/**
+ * Loads a WMC from the database.
+ *
+ * @param integer $wmc_id the ID of the WMC document in the database table "mb_user_wmc"
+ */
function createObjFromWMC_id($wmc_id){
global $DBSERVER,$DB,$OWNER,$PW;
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db(DB, $con);
- $sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = '" . $wmc_id . "'";
- $res = db_query($sql);
+ $sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1";
+ $v = array($wmc_id);
+ $t = array("i");
+ $res = db_prep_query($sql);
$wmc = db_fetch_row($res);
$this->createObjFromWMC_xml($wmc[0]);
$this->monitoringIsOn = true;
+}
-}
+/**
+ * Loads a WMC from an actual WMC XML document.
+ *
+ * @param string $data the data from the XML file
+ */
function createObjFromWMC_xml($data){
# $data = str_replace("&", "&", $data);
@@ -1022,6 +1058,16 @@
//return $verbose;
}
+ /**
+ * Creates JS code manipulating the map and wms objects,
+ * by this displaying the WMC
+ *
+ * @param string $target the link to the map object, f.e. "parent." or "window.opener."
+ * @param string $mapObj the name of the map object, f.e. "mapframe1"
+ * @param string $action "load", "merge" or "append"
+ *
+ * @return string the JS code
+ */
function createJsObjFromWMC($target, $mapObj, $action){
/*
More information about the Mapbender_commits
mailing list