fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13784]


From: Nelson Guerra
Subject: [Fmsystem-commits] [13784]
Date: Thu, 27 Aug 2015 00:08:12 +0000

Revision: 13784
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13784
Author:   nelson224
Date:     2015-08-27 00:08:11 +0000 (Thu, 27 Aug 2015)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind/rental/inc/class.uicommon.inc.php

Modified: branches/dev-syncromind/rental/inc/class.uicommon.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.uicommon.inc.php   2015-08-26 
13:35:49 UTC (rev 13783)
+++ branches/dev-syncromind/rental/inc/class.uicommon.inc.php   2015-08-27 
00:08:11 UTC (rev 13784)
@@ -83,6 +83,45 @@
                        $this->area_suffix = 
($config->config_data['area_suffix']) ? $config->config_data['area_suffix'] : 
'kvm';
                }
                
+        /**
+                * Download xls, csv or similar file representation of a data 
table
+                */
+        public function download()
+        {
+            $list = $this->query();
+
+            $keys = array();
+
+            if(count($list[0]) > 0) {
+                foreach($list[0] as $key => $value) {
+                    if(!is_array($value)) {
+                        array_push($keys, $key);
+                    }
+                }
+            }
+            
+            // Remove newlines from output
+            $count = count($list);
+            for($i = 0; $i < $count; $i++)
+            {
+                               foreach ($list[$i] as $key => &$data)
+                               {
+                                       $data = str_replace(array("\n","\r\n", 
"<br>"),'',$data);
+                               }
+            }
+
+             // Use keys as headings
+            $headings = array();
+            $count_keys = count($keys);
+            for($j=0;$j<$count_keys;$j++)
+            {
+               array_push($headings, lang($keys[$j]));
+            }
+
+            $property_common = CreateObject('property.bocommon');
+            $property_common->download($list, $keys, $headings);
+        }
+               
                /**
                 * Permission check. Proxy method for method check in 
phpgwapi->acl
                 * 




reply via email to

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