phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18587] clean: removing ugly csv hacks step 2 (using


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] [18587] clean: removing ugly csv hacks step 2 (using fputcvs thanks skwashd )
Date: Mon, 02 Jun 2008 15:08:59 +0000

Revision: 18587
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18587
Author:   maat
Date:     2008-06-02 15:08:58 +0000 (Mon, 02 Jun 2008)

Log Message:
-----------
clean: removing ugly csv hacks step 2 (using fputcvs thanks skwashd)

Modified Paths:
--------------
    trunk/ged/inc/class.ged_ui.inc.php

Modified: trunk/ged/inc/class.ged_ui.inc.php
===================================================================
--- trunk/ged/inc/class.ged_ui.inc.php  2008-06-02 14:09:48 UTC (rev 18586)
+++ trunk/ged/inc/class.ged_ui.inc.php  2008-06-02 15:08:58 UTC (rev 18587)
@@ -2091,22 +2091,36 @@
                                
//$download_size=filesize($version['file_full_path']);
                                //header('Content-Length: '.$download_size, 
false);
                                //readfile($version['file_full_path']);
+                               
+                               $fp = fopen('php://output', 'w');
+                               
                                foreach ($chronos as $chrono_type)
                                {
                                        foreach($chrono_type as $chrono)
                                        {
-                                               $link_data=null;
-                                               
$link_data['menuaction']='ged.ged_ui.browse';
-                                               
$link_data['focused_id']=$chrono['element_id'];
-                                               
$link_data['version_id']=$chrono['version_id'];
+                                               $link_data=array
+                                               (
+                                                       'menuaction' => 
'ged.ged_ui.browse',
+                                                       'focused_id' => 
$chrono['element_id'],
+                                                       'version_id' => 
$chrono['version_id']
+                                               );
                                                
$url=$GLOBALS['phpgw']->link('/index.php', $link_data, true);
                                                
-                                               
print($chrono['reference'].";".$chrono['name'].";".$chrono['version_label'].
-                                               
";".$GLOBALS['phpgw']->common->grab_owner_name($chrono['creator_id']).
-                                               
";".$chrono['status'].";".$GLOBALS['phpgw']->common->show_date($chrono['date']).
-                                               ";\"".$url."\"\n");
+                                               $row=array 
+                                               (
+                                                       $chrono['reference'],
+                                                       $chrono['name'],
+                                                       
$chrono['version_label'],
+                                                       
$GLOBALS['phpgw']->common->grab_owner_name($chrono['creator_id']),
+                                                       $chrono['status'],
+                                                       
$GLOBALS['phpgw']->common->show_date($chrono['date']),
+                                                       $url
+                                               );
+                                               
+                                               fputcsv($fp, $row, ";", "\"");
                                        }
                                }
+                               fclose($fp);
                        }
                        else
                        {
@@ -2118,23 +2132,37 @@
                                
//$download_size=filesize($version['file_full_path']);
                                //header('Content-Length: '.$download_size, 
false);
                                //readfile($version['file_full_path']);
+                               
+                               $fp = fopen('php://output', 'w');
+                               
                                foreach ($chronos as $chrono_type)
                                {
                                        foreach($chrono_type as $chrono)
                                        {
-                                               $link_data=null;
-                                               
$link_data['menuaction']='ged.ged_ui.browse';
-                                               
$link_data['focused_id']=$chrono['element_id'];
-                                               
$link_data['version_id']=$chrono['version_id'];
+                                               $link_data=array
+                                               (
+                                                       'menuaction' => 
'ged.ged_ui.browse',
+                                                       'focused_id' => 
$chrono['element_id'],
+                                                       'version_id' => 
$chrono['version_id']
+                                               );
                                                
$url=$GLOBALS['phpgw']->link('/index.php', $link_data, true);
                                                
-                                               
print($chrono['reference'].";".$chrono['name'].";".$chrono['version_label'].
-                                               
";".$GLOBALS['phpgw']->common->grab_owner_name($chrono['creator_id']).
-                                               
";".$chrono['status'].";".$GLOBALS['phpgw']->common->show_date($chrono['date']).
-                                               ";\"".$url."\"\n");
+                                               $row=array 
+                                               (
+                                                       $chrono['reference'],
+                                                       $chrono['name'],
+                                                       
$chrono['version_label'],
+                                                       
$GLOBALS['phpgw']->common->grab_owner_name($chrono['creator_id']),
+                                                       $chrono['status'],
+                                                       
$GLOBALS['phpgw']->common->show_date($chrono['date']),
+                                                       $url
+                                               );
+                                               
+                                               fputcsv($fp, $row, ";", "\"");
                                        }
                                }
-               }
+                               fclose($fp);
+                       }
                }
                else
                {
@@ -2215,22 +2243,37 @@
                                header('Cache-control: private, 
must-revalidate');
                                header("Content-Type: 
application/force-download");
                                header('Content-Disposition: attachment; 
filename="dico.csv"', false);
+
+                               $fp = fopen('php://output', 'w');
+                               
                                foreach ($all_versions as $version_type)
                                {
                                        foreach($version_type as $version)
                                        {
-                                               $link_data=null;
-                                               
$link_data['menuaction']='ged.ged_ui.browse';
-                                               
$link_data['focused_id']=$version['element_id'];
-                                               
$link_data['version_id']=$version['version_id'];
+                                               $link_data=array
+                                               (
+                                                       'menuaction' => 
'ged.ged_ui.browse',
+                                                       'focused_id' => 
$version['element_id'],
+                                                       'version_id' => 
$version['version_id']
+                                               );
                                                
$url=$GLOBALS['phpgw']->link('/index.php', $link_data, true);
                                                
-                                               
print($version['reference'].";".$version['name'].";".$version['version_label'].
-                                               
";".$GLOBALS['phpgw']->common->grab_owner_name($version['creator_id']).
-                                               
";".$version['status'].";".$GLOBALS['phpgw']->common->show_date($version['date']).
-                                               ";\"".$url."\"\n");
+                                               $row=array 
+                                               (
+                                                       $version['reference'],
+                                                       $version['name'],
+                                                       
$version['version_label'],
+                                                       
$GLOBALS['phpgw']->common->grab_owner_name($version['creator_id']),
+                                                       $version['status'],
+                                                       
$GLOBALS['phpgw']->common->show_date($version['date']),
+                                                       $url
+                                               );
+                                               
+                                               fputcsv($fp, $row, ";", "\"");
                                        }
                                }
+                               
+                               fclose($fp);
                        }
                        else
                        {
@@ -2239,23 +2282,37 @@
                                header('Cache-Control: must-revalidate', false);
                                header("Content-type: text/csv", false);
                                header('Content-Disposition: attachment; 
filename="dico.csv"', false);
+
+                               $fp = fopen('php://output', 'w');
+                               
                                foreach ($all_versions as $version_type)
                                {
                                        foreach($version_type as $version)
                                        {
-                                               $link_data=null;
-                                               
$link_data['menuaction']='ged.ged_ui.browse';
-                                               
$link_data['focused_id']=$version['element_id'];
-                                               
$link_data['version_id']=$version['version_id'];
+                                               $link_data=array
+                                               (
+                                                       'menuaction' => 
'ged.ged_ui.browse',
+                                                       'focused_id' => 
$version['element_id'],
+                                                       'version_id' => 
$version['version_id']
+                                               );
                                                
$url=$GLOBALS['phpgw']->link('/index.php', $link_data, true);
                                                
-                                               
print($version['reference'].";".$version['name'].";".$version['version_label'].
-                                               
";".$GLOBALS['phpgw']->common->grab_owner_name($version['creator_id']).
-                                               
";".$version['status'].";".$GLOBALS['phpgw']->common->show_date($version['date']).
-                                               ";\"".$url."\"\n");
+                                               $row=array 
+                                               (
+                                                       $version['reference'],
+                                                       $version['name'],
+                                                       
$version['version_label'],
+                                                       
$GLOBALS['phpgw']->common->grab_owner_name($version['creator_id']),
+                                                       $version['status'],
+                                                       
$GLOBALS['phpgw']->common->show_date($version['date']),
+                                                       $url
+                                               );
+                                               
+                                               fputcsv($fp, $row, ";", "\"");
                                        }
                                }
-               }
+                               fclose($fp);
+                       }
                }
                else
                {






reply via email to

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