Added rantest and cqtool to repo
[clearscm.git] / rantest / web / php / exportToCVS.php
diff --git a/rantest/web/php/exportToCVS.php b/rantest/web/php/exportToCVS.php
new file mode 100644 (file)
index 0000000..54943ef
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//
+// File:       exportToCVS.php
+// Description:        Exports a table to CVS
+// Author:     Andrew@ClearSCm.com
+// Created:    Mon Apr 28 15:20:06 MST 2008
+// Modified:   
+// Language:   PHP
+//
+// (c) Copyright 2000-2008, General Dynamics, all rights reserved.
+//
+////////////////////////////////////////////////////////////////////////////////
+function exportToCSV ($filename, $data) {
+  header ("Content-Type: application/octect-stream");
+  header ("Content-Disposition: attachment; filename=$filename");
+
+  foreach ($data as $line) {
+    foreach ($line as $key => $value) {
+      if (!$first_time) {
+       print ",\"$value\"";
+      } else {
+       print "\"$value\"";
+      } // if
+    } // foreach
+  } // foreach
+} // exportToCSV