[Mapbender-commits] r6237 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jun 2 05:48:55 EDT 2010
Author: verenadiewald
Date: 2010-06-02 05:48:55 -0400 (Wed, 02 Jun 2010)
New Revision: 6237
Modified:
trunk/mapbender/http/classes/class_wfsToDb.php
Log:
added all metadata fields, added termsofuse, added metadata categories
Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php 2010-06-02 09:47:27 UTC (rev 6236)
+++ trunk/mapbender/http/classes/class_wfsToDb.php 2010-06-02 09:48:55 UTC (rev 6237)
@@ -107,8 +107,12 @@
$sql .= "wfs_abstract = $4, wfs_getcapabilities = $5, wfs_getcapabilities_doc = $6, ";
$sql .= "wfs_upload_url = $7, wfs_describefeaturetype = $8, wfs_getfeature = $9, ";
$sql .= "wfs_transaction = $10, fees = $11, accessconstraints = $12, ";
- $sql .= "wfs_timestamp = $13 ";
- $sql .= "WHERE wfs_id = $14";
+ $sql .= "individualname = $13, positionname = $14, providername = $15, ";
+ $sql .= "city = $16, deliverypoint = $17, administrativearea = $18, ";
+ $sql .= "postalcode = $19, voice = $20, facsimile = $21, ";
+ $sql .= "electronicmailaddress = $22, country = $23, ";
+ $sql .= "wfs_timestamp = $24 ";
+ $sql .= "WHERE wfs_id = $25";
$v = array(
$aWfs->getVersion(),
@@ -122,12 +126,23 @@
$aWfs->getFeature,
$aWfs->transaction,
$aWfs->fees,
- $aWfs->accessconstraints,
+ $aWfs->accessconstraints,
+ $aWfs->individualName,
+ $aWfs->positionName,
+ $aWfs->providerName,
+ $aWfs->city,
+ $aWfs->deliveryPoint,
+ $aWfs->administrativeArea,
+ $aWfs->postalCode,
+ $aWfs->voice,
+ $aWfs->facsimile,
+ $aWfs->electronicMailAddress,
+ $aWfs->country,
strtotime("now"),
$aWfs->id
);
- $t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s', 'i' ,'i');
+ $t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s','s' ,'s','s','s','s','s','s','s','s','s','s','i' ,'i');
$e = new mb_exception("UPDATING WFS " . $aWfs->id);
$res = db_prep_query($sql, $v, $t);
if (!$res) {
@@ -136,7 +151,17 @@
return false;
}
+ # delete and refill wfs_termsofuse
+ $sql = "DELETE FROM wfs_termsofuse WHERE fkey_wfs_id = $1 ";
+ $v = array($aWfs->id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ WfsToDb::insertTermsOfUse($aWfs);
+
$featureTypeNameArray = array();
for ($i = 0; $i < count($aWfs->featureTypeArray); $i++) {
$currentFeatureType = $aWfs->featureTypeArray[$i];
@@ -228,8 +253,28 @@
return false;
}
+ /**
+ * Inserts the terms of use for a WFS in the database.
+ *
+ * @return Boolean
+ * @param $aWfs Wfs
+ */
+ public static function insertTermsOfUse ($aWfs) {
+ if (!is_numeric($aWfs->wfs_termsofuse)) {
+ return;
+ }
+ $sql ="INSERT INTO wfs_termsofuse (fkey_wfs_id, fkey_termsofuse_id) ";
+ $sql .= " VALUES($1,$2)";
+ $v = array($aWfs->id,$aWfs->wfs_termsofuse);
+ $t = array('i','i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ $e = new mb_exception("Error while inserting WFS termsofuse into the database.");
+ return false;
+ }
+ return true;
+ }
-
//-----------------------------------------------------------------------
//
// PRIVATE
@@ -519,6 +564,38 @@
return false;
}
}
+
+ // update categories for feature type
+ $types = array("md_topic", "inspire", "custom");
+ foreach ($types as $cat) {
+ $sql = "DELETE FROM wfs_featuretype_{$cat}_category WHERE fkey_featuretype_id = $1";
+ $v = array($aWfsFeatureType->id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ $e = new mb_exception("Error while deleting old categories for WFS feature type in the database.");
+ return false;
+ }
+
+ $attr = "featuretype_{$cat}_category_id";
+ $k = $aWfsFeatureType->$attr;
+
+ if($aWfsFeatureType->$attr && count($k) > 0) {
+ for ($j = 0; $j < count($k); $j++) {
+ if ($k[$j] != "") {
+ $sql = "INSERT INTO wfs_featuretype_{$cat}_category (fkey_featuretype_id, fkey_{$cat}_category_id) VALUES ($1, $2)";
+ $v = array($aWfsFeatureType->id, $k[$j]);
+ $t = array('i', 'i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ $e = new mb_exception("Error while inserting WFS feature type categories into the database.");
+ return false;
+ }
+ }
+ }
+ }
+ }
+
return true;
}
More information about the Mapbender_commits
mailing list