phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc/cron export_info_as_files.php


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc/cron export_info_as_files.php
Date: Wed, 15 Aug 2007 19:29:05 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   07/08/15 19:29:05

Modified files:
        inc/cron       : export_info_as_files.php 

Log message:
        add method for xml-output

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/cron/export_info_as_files.php?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: export_info_as_files.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/cron/export_info_as_files.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- export_info_as_files.php    15 Aug 2007 13:59:21 -0000      1.1
+++ export_info_as_files.php    15 Aug 2007 19:29:04 -0000      1.2
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage custom
-       * @version $Id: export_info_as_files.php,v 1.1 2007/08/15 13:59:21 
sigurdne Exp $
+       * @version $Id: export_info_as_files.php,v 1.2 2007/08/15 19:29:04 
sigurdne Exp $
        */
 
        /**
@@ -47,9 +47,11 @@
                        $this->join                             = 
$this->db->join;
                        $this->like                             = 
$this->db->like;
                        $this->left_join                = " LEFT JOIN ";
-                       $this->saveto                   = 
'/mnt/filer2/VaktPC_filer';
+               //      $this->saveto                   = 
'/mnt/filer2/VaktPC_filer';
+                       $this->saveto                   = '/tmp';
                //      $this->export_method = 'csv';
-                       $this->export_method = 'excel'; 
+               //      $this->export_method = 'excel';
+                       $this->export_method = 'xml'; 
 
                }
 
@@ -178,8 +180,10 @@
                                case 'csv':
                                        
$this->export_as_csv($name,$descr,$filename, $sql);
                                        break;
+                               case 'xml':
+                                       
$this->export_as_xml($name,$descr,$filename, $sql);
+                                       break;
                        }
-               
                }
 
                function export_brannalarm()
@@ -297,5 +301,47 @@
 
                        fclose($fp);                    
                }
+               
+               function export_as_xml($name,$descr,$filename, $sql)
+               {
+                       $descr[] = lang('date');
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $j=0;
+                       while ($this->db->next_record())
+                       {
+                               for ($i=0;$i<count($name);$i++)
+                               {
+                                       $xmlvars[$j][$descr[$i]] = 
str_replace(array("\r","\n")," 
",$this->bocommon->utf2ascii($this->db->f($name[$i])));
+                               }
+                               $xmlvars[$j][$descr[$i]] = 
$GLOBALS['phpgw']->common->show_date(time(),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $j++;
+                       }
+
+                       $xmltool = CreateObject('phpgwapi.xmltool');
+                       while(list($key,$value) = each($xmlvars))
+                       {
+                               $xmldata[$key] = $value;
+                       }
+
+                       $xml = var2xml('PHPGW',$xmldata);
+                       $fp = fopen($this->saveto . SEP . $filename . 
'.xml','wb');
+                       fwrite($fp,$xml);
+                       fclose($fp);
+               }
+               
+/*             
+               function arrayToXML($a) 
+               {
+                       $xml = '';
+
+                       foreach($a as $k => $v)
+                       $xml .= "<$k>" . (is_array($v) ? $this->arrayToXML($v) 
: $v) . "</$k>";
+
+                       return $xml;
        }
+*/
+               
+       }
+       
 ?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]