Location: PHPKode > projects > OpenBizMap > openbizmap/mydata/script/exp_.txt
<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

$opt=get('opt');
$content='<'.'?xml version="1.0" ?'.'>'.CRLF;
$content.='<root info="odb export" range="'.$search.'" date="'.date('Ymd H:i:s').'">'.CRLF;
$result_array=search($search);

$show_result_array=array();
$column_array=array();
$result_array=search($search);
for($ii=0;$ii<count($result_array);$ii++)
{
  $variable_array=$result_array[$ii];

  $column_name_array=explode('$',$variable_array);
  for($jj=1;$jj<count($column_name_array)-1;$jj++)
  {
    $vpos=strpos($column_name_array[$jj],'=');
    $key=substr($column_name_array[$jj],0,$vpos);
    $val=substr($column_name_array[$jj],$vpos+1);
    $column_array[$key]=1;
    $show_result_array[$ii][$key]=$val;
  }
}

$sizeof=sizeof($show_result_array);

//data
for($ii=0;$ii<$sizeof;$ii++)
{
  $variable_array=$show_result_array[$ii];
  reset($variable_array);
  //$content.='<'.purename($variable_array['sysGroupBy']).' name="'.$variable_array['sysGroupBy'].'">'.CRLF;
  $attribs_used_array=array();
  if($opt!='geo')
    $content.='<'.purename($variable_array['sysGroupBy']);
  else
    $content.='<geo';

  if($opt!='geo')
  {
    while(list($key,$attributes_array)=each($variable_array))
    {
      if(substr($key,0,3)!='sys' or $key=='sysId')
      if(!isset($attribs_used_array[purename($key)]))
      {
        $attribs_used_array[purename($key)]=1;
        $content.=' '.CRLF.' '.purename($key).'_name="'.$key.'"';
        $content.=' '.purename($key).'="'.htmlspecialchars($attributes_array,ENT_QUOTES,'UTF-8').'"';
  
      /*
        reset($attributes_array);
        while(list($attribute,$value)=each($attributes_array))
        {
          if(strlen($value) and ($attribute=='description' or $attribute=='template' or $attribute=='dict' or $attribute=='tab' or $attribute=='formula' or $attribute=='show_cond'))
            $content.=' '.purename($key).'_'.$attribute.'="'.$value.'"';
        }
      */
      }
    }
  }
  else //geo
  {
    $content.=' sysid="'.$variable_array['sysId'].'"';
    $content.=' icon="'.$variable_array['Icon'].'"';
    $content.=' latitude="'.$variable_array['Latitude'].'"';
    $content.=' longitude="'.$variable_array['Longitude'].'"';
  }
  $content.='/>'.CRLF;
}
$content.='</root>'.CRLF;

header('Content-Type: text/xml');
header('Content-Disposition: attachement; filename="'.purename($search).'.xml"'); //attachement couses too much dialog boxes /inline
header('Content-Length: '.strlen($content));

echo $content;

?>
Return current item: OpenBizMap