use Cubist\Backpack\Magic\Fields\SelectFromArray;
use Cubist\Backpack\Magic\Fields\StandardFile;
use Cubist\Backpack\Magic\Form;
-use ExcelToArray;
-use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
+use Cubist\Excel\ExcelToArray;
use Symfony\Component\HttpFoundation\File\UploadedFile;
trait Excel2JSON
{
/** @var UploadedFile $file */
$file = request()->file('file');
- $dataorg = request()->file('dataorg', 'excelToArray');
- $format = request()->file('format', 'json');
+ $dataorg = request()->input('dataorg', 'excelToArray');
+ $format = request()->input('format', 'json');
ExcelToArray::setCache(protected_path('tools/exceltojson'));
throw new \Exception('Type not allowed');
}
$function = $dataOrgs[$dataorg]['function'] ?? $dataorg;
- $res = ExcelToArray::$function($file->getFilename());
+
+ $res = ExcelToArray::$function($file->getPathname());
if ($format === 'json') {
return response()->json($res);
{
$json = request()->get('json');
$name = request()->get('filename', 'json');
+ if (!$name) {
+ $name = 'json';
+ }
$safename = Str::slug($name);
$data = json_decode($json, true);
$first = true;
use App\Models\FluidbookTranslate;
use App\Models\Traits\FluidbookPlayerBranches;
use App\Util\FluidbookLinks;
+use Cubist\Excel\ExcelToArray;
use Cubist\Locale\Country;
use Cubist\Locale\Locale;
use Cubist\PDF\CommandLine\FWSTK;
use DOMDocument;
use DOMElement;
use DOMXPath;
-use ExcelToArray;
use Fluidbook\Tools\Compiler\CompilerInterface;
use Fluidbook\Tools\Links\AnchorLink;
use Fluidbook\Tools\Links\ContentLink;
class FluidbookPublication extends ToolboxSettingsModel
{
- public mixed $pdfName;
protected $table = 'fluidbook_publication';
protected $_options = ['name' => 'fluidbook-publication',
'singular' => 'publication',
"nyholm/psr7": "^1.5",
"php-ffmpeg/php-ffmpeg": "^0.18.0",
"rustici-software/scormcloud-api-v2-client-php": "^2.0",
- "symfony/http-client": "^v6.1"
+ "symfony/http-client": "^v6.0"
},
"require-dev": {
"facade/ignition": "^2.17",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "019aa2a9f00c7b3efacf70112d0d11fc",
+ "content-hash": "ddfabb800534167f67df33102116b584",
"packages": [
{
"name": "ahmadshah/lucy",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_excel.git",
- "reference": "b6f1ddf50862ffef4dfaf50836d5bfad02a66152"
+ "reference": "afa5add00dc6e002c6c5ee072c956e11371d3450"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/excel/cubist-excel-dev-master-f2dc61.tar",
- "reference": "b6f1ddf50862ffef4dfaf50836d5bfad02a66152",
- "shasum": "71e74b43b9740684f4a4bf3cdb151216223fee1d"
+ "url": "https://composer.cubedesigners.com/dist/cubist/excel/cubist-excel-dev-master-604639.tar",
+ "reference": "afa5add00dc6e002c6c5ee072c956e11371d3450",
+ "shasum": "14e9a9b90d49d77cb775115ac0ccf42f3bb9ce6f"
},
"require": {
"cubist/util": "dev-master",
}
],
"description": "Excel files manipulation",
- "time": "2022-08-24T11:32:02+00:00"
+ "time": "2022-08-24T12:11:58+00:00"
},
{
"name": "cubist/gtag",
var json = $(this).closest('.bunchmultiple[data-values]').find('.hiddenfield').eq(0).val();
var form = $('<form action="{{backpack_url('tools/dojson2excel')}}" method="post">' +
'<input type="hidden" name="json" value="" />' +
- '<input type="hidden" name="filename" value="" />' +
+ '<input type="hidden" name="filename" value="chapters_{{$entry->id}}" />' +
'<input type="hidden" name="_token" value="{{csrf_token()}}" />' +
'</form>'
)
$(document).on('click', '.chaptersImportExcel', function () {
var form = $('<form style="opacity:0;position:absolute;top:0;left:0;" action="{{backpack_url('opentools/doexcel2json')}}" enctype="multipart/form-data" method="post">' +
'<input type="file" name="file" value="" accept=".xlsx" />' +
- '<input type="hidden" name="dataorg" value="excelToArrayKeyVars" />' +
+ '<input type="hidden" name="dataorg" value="excelToArrayIndexKeyVars" />' +
'<input type="hidden" name="format" value="json" />' +
'<input type="hidden" name="_token" value="{{csrf_token()}}" />' +
'</form>'
$(form).ajaxSubmit({
success: function (data) {
var bm = $('[data-bunch-name="{{$field['name']}}"]').data('bunchmultiple');
- bm.replaceData(data[0].data);
+ bm.replaceData(data);
}
});
});