Location: PHPKode > projects > OpenBizMap > openbizmap/mydata/script/exp_html.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.
*/

header('Content-Type: text/xls; charset=utf-8');
header('Content-Disposition: attachement; filename="html.xls"'); //attachement couses too much dialog boxes /inline
//header('Content-Length: '.strlen($content));

$content='';
$group_array=array();

$content.='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$content.='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >';
$content.='<head>';
$content.='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
$content.='<title>'.cfg_skin_name.' '.USERGROUP.' '.USERDESCRIPTION.'</title>';
$content.='</head>';
$content.='<body>';

$addsearch_count=0;
$tmp_search=$search;
while(strlen($tmp_search))
{
  $show_result_array=search($tmp_search);
  $show_result_array_sizeof=count($show_result_array);

  mylog('HTML EXPORT '.$tmp_search);

  if($show_result_array_sizeof>0)
  {
    $sizeof=count($show_result_array);
    for($ii=0;$ii<$sizeof;$ii++)
    {
      $variable_array=$show_result_array[$ii];

      if(check_access(read($variable_array,'MyBag')))
      {
        $group_name=strtolower(read($variable_array,'sysGroupBy'));
        $group_array[$group_name][]=$variable_array;
      }
    }
  }
  $addsearch_count++;
  $tmp_search=get('adsearch'.$addsearch_count);
}

reset($group_array);
while(list($group_name,$show_result_array)=each($group_array))
{
  $fields=get($group_name.'_fields');
  if($fields)
  {
    $tmp_variable_array2=explode(',',$fields);
    reset($tmp_variable_array2);
    while(list($tmp,$val)=each($tmp_variable_array2))
      $variable_array2[$val]='1';
  }
  else
    $variable_array2=load_config($group_name);

  $content.='<h1>'.myecho($variable_array2['sysListTitle']['value'],'RETURN').'</h1>';
  $content.='<table border="0">';

    $content.='<tr>';
    $content.='<td>';
    $content.='';
    $content.='</td>';

    reset($variable_array2);
    while(list($variable_name,$tmp)=each($variable_array2))
    {
      if(substr($variable_name,0,3)!='sys')
      {
        $content.='<td>';
        $content.=$variable_name;
        $content.='</td>';
      }
    }

    $content.='<td>';
    $content.='sysId';
    $content.='</td>';

    $content.='</tr>';

  $cnt=1;
  reset($show_result_array);
  while(list($tmp,$line)=each($show_result_array))
  {
    $content.='<tr>';

    $content.='<td>';
    $content.=$cnt.'.';
    $content.='</td>';

    echo $content; $content='';

    reset($variable_array2);
    while(list($variable_name,$tmp)=each($variable_array2))
    {
      if(substr($variable_name,0,3)!='sys')
      {
        $content.='<td>';

        $template=$variable_array2[$variable_name]['template'];
        $show_value=read($line,$variable_name);
        $show_mode=CFG_LOAD;

        if(!file_exists(cfg_data_path.'/script/fld_'.$template.'.txt'))
          $template='';

        if($template!='')
          include(cfg_data_path.'/script/fld_'.$template.'.txt');

        $content.=$show_value;
        $content.='</td>';

        echo $content; $content='';
      }
    }

    $content.='<td>';
    $content.=read($line,'sysId');
    $content.='</td>';

    $content.='</tr>';
    $cnt++;

    echo $content; $content='';
  }
  $content.='</table>';
}
$content.='<div>EOF</div>';
$content.='</body>';
$content.='</html>';

echo $content; $content='';

?>
Return current item: OpenBizMap