Example #1
0
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']));
    }
  }
}
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']);
          }
        }
      }
    }
  }
}
Example #3
0
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']);
      }
    }
  }
}