[Mapbender-commits] r4605 - in branches/ur_dev: . install

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 9 09:42:08 EDT 2009


Author: uli
Date: 2009-09-09 09:42:06 -0400 (Wed, 09 Sep 2009)
New Revision: 4605

Added:
   branches/ur_dev/install/
   branches/ur_dev/install/class_dia.php
   branches/ur_dev/install/update.php
Log:
fist check in


Added: branches/ur_dev/install/class_dia.php
===================================================================
--- branches/ur_dev/install/class_dia.php	                        (rev 0)
+++ branches/ur_dev/install/class_dia.php	2009-09-09 13:42:06 UTC (rev 4605)
@@ -0,0 +1,64 @@
+<?php
+class Dia{
+	
+	private $xml;
+	
+	public function __construct () {
+	}
+	
+	public function load($filename){
+		
+		fwrite(STDOUT, "Loading: ".$filename."\n");
+		$domDoc = new DOMDocument();
+		$domDoc->preserveWhiteSpace = false;
+		$domDoc->load($filename);
+		$xp = new DOMXPath($domDoc);
+		// register composites
+		//$tables = $xmlDoc->xpath("//dia:layer[@name='Background']/dia:object[@type='UML - Class']");
+		$xp->registerNamespace('dia', 'http://www.lysator.liu.se/~alla/dia/');
+		$tables = $xp->query("//dia:layer[@name='Background']/dia:object[@type='UML - Class']");
+		fwrite(STDOUT, "Found ".$tables->length." composites\n");
+		$i = 0;
+		foreach ($tables as $table){
+			fwrite(STDOUT, "id: ".$table->getAttribute("id")." -- ".$i++."\n");
+			$attributes = $table->childNodes;
+			foreach($attributes as $attribute){
+				if($attribute->getAttribute("name") == 'name'){
+					fwrite(STDOUT, "TableName: ".$attribute->firstChild->nodeValue." \n");
+				}
+				if($attribute->getAttribute("name") == 'attributes'){
+//					fwrite(STDOUT, "found attributes \n");
+					$composites = $attribute->childNodes;
+					foreach($composites as $composite){
+//						fwrite(STDOUT, "found composites\n");
+						$columns = $composite->childNodes;
+						foreach($columns as $column){
+//							fwrite(STDOUT, "found columnvalues column=".$column->getAttribute('name')."\n");
+							if($column->getAttribute('name') == 'name'){
+								fwrite(STDOUT, "found name\n");
+								fwrite(STDOUT, "Column: ".$column->firstChild->nodeValue." \n");								
+							}
+							if($column->getAttribute('name') == 'type'){
+								fwrite(STDOUT, "found type\n");
+								fwrite(STDOUT, "Column: ".$column->firstChild->nodeValue." \n");								
+							}
+							if($column->getAttribute('name') == 'value'){
+								fwrite(STDOUT, "found value\n");
+								fwrite(STDOUT, "Column: ".$column->firstChild->nodeValue." \n");								
+							}
+							$columnvalues = $column->childNodes;
+						}
+					}					
+				}
+				
+				
+			}
+		}
+	}
+	
+	public function getTables($tableNode){
+		
+	}
+}
+
+?>
\ No newline at end of file

Added: branches/ur_dev/install/update.php
===================================================================
--- branches/ur_dev/install/update.php	                        (rev 0)
+++ branches/ur_dev/install/update.php	2009-09-09 13:42:06 UTC (rev 4605)
@@ -0,0 +1,28 @@
+<?php
+include("class_dia.php");
+$defaultfile = "../resources/db/schema_2.6.dia";
+
+fwrite(STDOUT, "Please enter the path to you *.dia file\n");
+fwrite(STDOUT, "default is ".$defaultfile."\n");
+
+// Read the input
+$filename = trim(fgets(STDIN));
+
+fwrite(STDOUT, "type: ".gettype($filename)."\n");
+if($filename == ''){
+	$filename = $defaultfile;
+}
+fwrite(STDOUT, "The File is: ".$filename." ... ".strlen($filename)."\n");
+fwrite(STDOUT, "try to read file ...\n");
+if(!is_readable($filename)){
+	fwrite(STDOUT, "failure!!!!\n");	
+}
+
+$dia = new Dia();
+$dia->load($filename);
+//fwrite(STDOUT, "Hello $name");
+
+// Exit correctly
+exit(0);
+
+?>



More information about the Mapbender_commits mailing list