version != "") $temp .= " version=\"".htmlspecialchars($this->version)."\""; $temp .= " xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\""; $temp .= " xmlns=\"http://www.opengis.net/sld\""; $temp .= " xmlns:ogc=\"http://www.opengis.net/ogc\""; $temp .= " xmlns:xlink=\"http://www.w3.org/1999/xlink\""; $temp .= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; $temp .= ">\n"; if ($this->name != "") $temp .= $offset." ".htmlspecialchars($this->name)."\n"; if ($this->title != "") $temp .= $offset." ".htmlspecialchars($this->title)."\n"; if ($this->abstract != "") $temp .= $offset." ".htmlspecialchars($this->abstract)."\n"; foreach($this->layers as $layer) { $temp .= $layer->generateXml($offset." "); } $temp .= $offset."\n"; return $temp; } /** * Generates a html-form-fragment * that contains form-elements (e.g. input) for every member of this class. * Some of these are hidden fields and so they are not editable by the user. * The reason for this is that some values should not be changed (such as the layer name) * or they are to complicated for end-users that are not familiar to the sld-xml-scheme. * * Calls the generateHtmlForm-function of its child objects. * * @param string $id string identifying the form-elements belonging to this object * @param string $offset string for formatting the output * @return string the created html-form-fragment */ function generateHtmlForm($id, $offset = "") { $temp = ""; //Commented out, because these options should not be changed by the end user //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."\n"; //$temp .= $offset."
Name:name."\">
Title:title."\">
Abstract:abstract."\">
Version:version."\">
\n"; //$temp .= $offset."
\n"; //Hidden fields to hold the values $temp .= $offset."name)."\">\n"; $temp .= $offset."title)."\">\n"; $temp .= $offset."abstract)."\">\n"; $temp .= $offset."version)."\">\n"; $layer_id = 0; foreach ($this->layers as $layer) { $temp .= $layer->generateHtmlForm("layer_".$layer_id, $offset." "); $layer_id++; } return $temp; } /** * Populates the member fields of a new object from the data in the http-post-request * to rebuild the object after the submission of the html-form. * * creates its own child objects from the post parameters and calls their * generateObjectFromPost(...) function * * @param string $id string that contains a prefix for the html-form-fields * that is common to all of the fields belonging to this object * this parameter has no use for this object, because it is only called without a value * in other classes this parameter should have the same value, that was used in * generateHtmlForm(...) for the $id to create the html-form * */ function generateObjectFromPost($id = "") { $this->version = $_REQUEST[$id."version"]; $this->name = $_REQUEST[$id."name"]; $this->title = $_REQUEST[$id."title"]; $this->abstract = $_REQUEST[$id."abstract"]; $countLayers = 0; while (isset($_REQUEST[$id."layer_".$countLayers])) { if ($_REQUEST[$id."layer_".$countLayers] == "namedlayer") { $layer = new NamedLayer(); } else { //Todo evtl: userlayer erstellen $layer = new NamedLayer(); } $layer->generateObjectFromPost($id."layer_".$countLayers); $this->layers[] = $layer; $countLayers++; } } } /** * Loads classes by name * * If the php interpreter finds a class that is needed in a module or class * and it is not yet included via include, then it tries to load this class * with the given name in the current context. No need for includes ... * * @param string $class_name */ function __autoload($class_name) { if (file_exists(dirname(__FILE__). "/{$class_name}.php")) require_once $class_name . '.php'; } ?>