]> _ Git - cubeextranet.git/commitdiff
wait #5414
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Aug 2022 13:33:27 +0000 (13:33 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Aug 2022 13:33:27 +0000 (13:33 +0000)
inc/commons/class.common.tools.php

index 4cf3be912bae26aabc858e6735a3bd7916900688..8297bab997e4f3078927fac49c9e165ae5e5d530 100644 (file)
@@ -1384,76 +1384,13 @@ class commonTools
 
     public static function xlsxToJson($args)
     {
-        global $core;
-        $res = commonPage::barre();
-        $res .= commonPage::tMain();
-        $res .= commonPage::bh();
-        $res .= '<form action="' . SITE_PATH . 'tools/convertXlsxToJson" method="post" class="notajax" enctype="multipart/form-data">';
-        $res .= '<table class="liste">';
-        $res .= '<tr><th><strong>' . __('Convertir un xlsx en json') . '</strong></th></tr>';
-        $res .= '<tr><td>' . __('Charger un fichier excel') . '</td><td><input type="file" name="file" /></td></tr>';
-        $res .= '<tr class="odd"><td>Organisation des données</td><td><select name="dataorg">
-            <option value="excelToArray">Conforme à la source</option>
-            <option value="excelToArrayKeyVal">Couples Clé/Valeur</option>
-            <option value="excelToArrayKeyVars">Liste nommée par le titre de colonne</option>
-            </select></td></tr>';
-        $res .= '<tr class=""><td>Format de sortie</td><td><select name="format"><option value="json">JSON</option><option value="js">JS</option></select></td></tr>';
-        $res .= '<tr class="odd"><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Convertion')) . '</a></td></td>';
-        $res .= '</table>';
-        $res .= '</form>';
-        $res .= '</div>';
-        $res .= commonPage::bf();
-        $res .= commonPage::bMain();
-        return $res;
+        header('Location: https://toolbox.fluidbook.com/opentools/excel2json', true, 308);
     }
 
 
     public static function convertXlsxToJson($args)
     {
-        require_once ROOT . '/inc/ws/Util/class.ws.util.php';
-        $f = $_POST['dataorg'];
-        $res = wsUtil::$f($_FILES['file']['tmp_name']);
-        $json = json_encode($res);
-        ob_end_clean();
-
-        if ($_POST['format'] === 'json') {
-            header('Content-Type: application/json');
-            die($json);
-        } else if ($_POST['format'] === 'js') {
-            header('Content-Type: application/javascript');
-            header('Content-Disposition: attachment; filename="data.js"');
-            die('var DATA=' . $json . ';');
-        }
-    }
-
-    public static function convertXlsxToKeyValueJson($args)
-    {
-        new PHPExcel();
-
-        $reader = new PHPExcel_Reader_Excel2007();
-        $xls = $reader->load($_FILES['file']['tmp_name']);
-
-        $res = [];
-        foreach ($xls->getAllSheets() as $sheet) {
-            $lines = $sheet->toArray();
-            foreach ($lines as $line) {
-                if (null === $line[0]) {
-                    continue;
-                }
-                $k = trim($line[0]);
-                if (!$k) {
-                    continue;
-                }
-                $v = trim($line[1]);
-                $res[$k] = $v;
-            }
-            break;
-        }
-
-        ob_end_clean();
-
-        header('Content-Type: application/json');
-        die(json_encode($res));
+        header('Location: https://toolbox.fluidbook.com/opentools/doexcel2json', true, 308);
     }
 
     public static function excelTranslationM($args)