コード例 #1
0
ファイル: metadata_themes.php プロジェクト: rahool/maplocator
function getThemesOfType($xmlDoc, &$rootNode, $paramsNode) {
  $theme_type = $paramsNode->getElementsByTagName('theme_type')->item(0)->nodeValue;

  $themes = getThemesByType($theme_type);
  if($themes === false) {
    setError($xmlDoc, $rootNode, "Error fetching information.");
  } else {
    setNoError($xmlDoc, $rootNode);
    $thmsNode = addXMLChildNode($xmlDoc, $rootNode, "themes", null, array('theme_type' => $theme_type));
    foreach($themes as $theme) {
      addXMLChildNode($xmlDoc, $thmsNode, "theme", null, array('theme_id' => $theme['theme_id'], 'theme_name' => $theme['theme_name'], 'icon' => getThemeIconUrl($theme['icon']), 'geolocation' => $theme['geolocation']));
    }
  }
}
コード例 #2
0
function getCategoricalLayersList($xmlDoc, &$rootNode, $paramsNode) {
  $theme_type = $paramsNode->getElementsByTagName('theme_type')->item(0)->nodeValue;

  if($theme_type == null || $theme_type == '') {
    setError($xmlDoc, $rootNode, "Required parameters not set.");
    return;
  } else {
    $themes = getThemesByType($theme_type);
    if($themes === false) {
      setError($xmlDoc, $rootNode, "Error fetching information.");
    } else {
      $layers = getLayersByThemeType($theme_type);
      if($layers === false) {
        setError($xmlDoc, $rootNode, "Error fetching information.");
      } else {
        setNoError($xmlDoc, $rootNode);
        $thmsNode = addXMLChildNode($xmlDoc, $rootNode, "themes", null, array('theme_type' => $theme_type));
        foreach($themes as $theme) {
          $chldcnt = sizeof($layers[$theme['theme_id']]);
          $theme['icon'] = getThemeIconUrl($theme['icon']);
          $thmNode = addXMLChildNode($xmlDoc, $thmsNode, "theme", null, $theme);
          foreach($layers[$theme['theme_id']] as $lyr) {
            formLayersListXML($xmlDoc, $thmNode, $lyr['layer_tablename'], $lyr['layer_name'], $lyr['access'], $lyr['p_nid'], $lyr['participation_type']);
          }
        }
      }
    }
  }
}
コード例 #3
0
ファイル: xmlfunctions.php プロジェクト: rahool/maplocator
function createXMLForThemeChildNodes($xmlDoc, &$rootNode, $thms) {
  foreach($thms as $thm) {
    if($thm['type'] == 'layer') {
      $attr = array('id' => $thm['id'], 'name' => $thm['name'], 'type' => $thm['layer_type'], 'nid' => $thm['nid']);
      $tNode = addXMLChildNode($xmlDoc, $rootNode, "layer", null, $attr);
    } else {
      $attr = array('type' => $thm['type'], 'id' => $thm['id'], 'name' => $thm['name'], 'icon' => getThemeIconUrl($theme['icon']));
      $tNode = addXMLChildNode($xmlDoc, $rootNode, "theme", null, $attr);
      if(isset($thm['children'])) {
        createXMLForThemeChildNodes($xmlDoc, $tNode, $thm['children']);
      }
    }
  }
}