ExcelToJson.php
[Pman.Core] / ExcelToJson.php
index 5dfca9f..8fe9738 100644 (file)
@@ -31,6 +31,9 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         $fc = new File_Convert($img->getStoreName(), $img->mimetype );
         $csv = $fc->convert('text/csv');
         $ret = $this->importCsv($csv);
+        
+        print_R($ret);exit;
+        
         $this->jdata($ret['data'], false, isset($ret['extra']) ? $ret['extra'] : array() );
         
     }
@@ -48,7 +51,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         $cols = false;
         $header = false;
         $rows = array();
-        $ret = array();
+        $extra = array();
         
         while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
             if(!array_filter($n)){
@@ -60,7 +63,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
             }
             
             if(!$header){
-               $ret[preg_replace(array('/\s/', '/\:/'), '', $n[0])] = $n[1];
+               $extra[preg_replace(array('/\s/', '/\:/'), '', $n[0])] = $n[1];
                continue;
             }
             
@@ -86,6 +89,9 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         }
         fclose($fh);
         
-        return array('extra' => $ret, 'data' => $rows);;
+        $ret = array('extra' => $extra, 'data' => $rows);
+        echo 'about to return?';print_R($ret);exit;
+        
+        return array('extra' => $extra, 'data' => $rows);;
     }
 }
\ No newline at end of file