function formLayersListXML($xmlDoc, &$rootNode, $layer_tablename, $layer_name, $access, $p_nid, $participation_type) { $imgPath = base_path() . path_to_theme().'/images/icons/'; $layertype = ''; /* get the layer type */ $query = 'select layer_type from "Meta_Layer" where layer_tablename= \'%s\''; $result = db_query($query, $layer_tablename); while($row = db_fetch_object($result)) { $layertype = $row->layer_type; } $attribs = array(); $attribs['layer_tablename'] = $layer_tablename; $attribs['layer_name'] = $layer_name; $attribs['icon'] = getLayerIconUrl($layer_tablename); $layersChecked = explode(":", $_COOKIE['layersChecked']); if (in_array($layer_tablename, $layersChecked)) { $attribs['checked'] = 1; } else { $attribs['checked'] = 0; } $lyrNode = addXMLChildNode($xmlDoc, $rootNode, "layer", null, $attribs); $toolsNode = addXMLChildNode($xmlDoc, $lyrNode, "tools"); addTool($xmlDoc, $toolsNode, 'information', $imgPath .'information.png', $layer_name . ' Information', 'getLayerMetadata', array($layer_tablename)); if ($participation_type > 0) { addTool($xmlDoc, $toolsNode, 'participate', $imgPath .'participate.png', 'Participation Info for ' . $layer_name, 'showParticipationInfo', array($layer_tablename, $p_nid)); } if($access) { addTool($xmlDoc, $toolsNode, 'download', $imgPath .'download-layertree.png', 'Download ' . $layer_name, 'getDownloadFormats', array($layer_tablename)); } addTool($xmlDoc, $toolsNode, 'ZTE', $imgPath .'zoom-to-extent.png', 'Zoom to layer extent', 'zoomToExtent', array(getLayerExtent($layer_tablename,$layertype))); }
if ($action == "simpleSuggestion") { $toolSuggestion = $_POST["toolSuggestion"]; if (isset($toolSuggestion)) { simpleSuggestion($toolSuggestion); } } else { if ($action == "newTool" || $action == "editTool") { $name = $_POST["name"]; $description = $_POST["description"]; $pitch = $_POST["pitch"]; $url = $_POST["url"]; $icon = $_POST["icon"]; if (isset($_POST["tags"])) { $tags = $_POST["tags"]; } else { $tags = array(); } if (isset($name) && isset($url) && isset($pitch) && isset($icon)) { if ($action == "newTool") { addTool($name, $url, $pitch, $description, $icon, $tags); header('Location: new-tool.php'); } if ($action == "editTool") { updateTool($name, $url, $pitch, $description, $icon, $tags); header('Location: select-tool.php'); } } } } } }