return $fname;
}
+
+ 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></tr>';
+ $res .= '<tr class="odd"><td><input type="file" name="file" /></td></tr>';
+ $res .= '<tr><td class="right"><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;
+ }
+
+ public static function convertXlsxToJson($args)
+ {
+ new PHPExcel();
+
+ $reader = new PHPExcel_Reader_Excel2007();
+ $xls = $reader->load($_FILES['file']['tmp_name']);
+
+ $res = [];
+ foreach ($xls->getAllSheets() as $sheet) {
+ $res[$sheet->getTitle()]=$sheet->toArray();
+ }
+
+ ob_end_clean();
+
+ header('Content-Type: application/json');
+ die(json_encode($res));
+ }
}