On gere correctement l'envoi du json complet ou seulement ce qui est
affiché, attention , il faut gerer la conf de php correctement, cf readme. On change le nom du fichier, plus besoin qu'il soit hashé maintenant, car un job le supprimera
This commit is contained in:
parent
738688516d
commit
f2272fe2c6
4 changed files with 76 additions and 47 deletions
10
README.md
10
README.md
|
@ -9,6 +9,16 @@ Dans cette nouvelle version, on découpe le stockage en 2:
|
|||
## Configuration
|
||||
Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev
|
||||
|
||||
### PHP dans php.ini
|
||||
* post_max_size which is directly related to the POST size
|
||||
* upload_max_filesize which may be unrelated, not sure
|
||||
* max_input_time, if the POSt takes too long
|
||||
* max_input_nesting_level if your data is an array with a lot of sublevels
|
||||
* max_execution_time, but quite sure it’s not that
|
||||
* memory_limit, as you may reach a size exceding the subprocess allowed memory
|
||||
* max_input_vars, if your data array has many elements => **le plus important**
|
||||
|
||||
|
||||
## Utilisation
|
||||
- charger l'inclure (5 args possibles et facultatifs)
|
||||
```html
|
||||
|
|
|
@ -11,9 +11,9 @@ function action_pdf_gamutable_dist() {
|
|||
}
|
||||
|
||||
$fichierpdf = _request('fichierpdf') ?? '';
|
||||
// $namepdf = _request('namepdf') ?? $fichierpdf;
|
||||
$namepdf = _request('namepdf') ?? $fichierpdf;
|
||||
$header = _request('header') ?? [];
|
||||
$Tdata = _request('data') ?? [];
|
||||
$Tdata = _request('Tdata') ?? [];
|
||||
$arg = _request('arg') ?? '';
|
||||
|
||||
if (empty($header) or empty($fichierpdf)) {
|
||||
|
@ -23,15 +23,14 @@ function action_pdf_gamutable_dist() {
|
|||
$Tcles = [];
|
||||
if (!empty($Tdata)) {
|
||||
foreach ($Tdata as $d) {
|
||||
$Tcles[] = $d['html']['id'];
|
||||
$Tcles[] = $d['id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (find_in_path('gamutable_pdf/' . $fichierpdf . '.html')) {
|
||||
$set = ['arg' => $arg];
|
||||
if (!empty($Tcles)) {
|
||||
$set = array_merge($set, ['Lids' => implode(',', $Tcles)]);
|
||||
$set = array_merge($set, ['Tids' => $Tcles]);
|
||||
}
|
||||
$fond = recuperer_fond('gamutable_pdf/' . $fichierpdf, $set);
|
||||
|
||||
|
@ -43,10 +42,10 @@ function action_pdf_gamutable_dist() {
|
|||
include_spip('spipdf_options');
|
||||
include_spip('inc/spipdf');
|
||||
|
||||
$namepdf = 'pdf_' . time();
|
||||
$namepdf = date("Y-m-d_H-i") . '_' . $namepdf;
|
||||
$a = spipdf_html2pdf($fond);
|
||||
$dir = sous_repertoire(_DIR_IMG . 'pdfgamutable');
|
||||
$chemin = $dir . md5($namepdf) . '.pdf' ;
|
||||
$chemin = $dir . $namepdf . '.pdf' ;
|
||||
file_put_contents($chemin, $a);
|
||||
|
||||
$id_job = job_queue_add(
|
||||
|
|
|
@ -197,9 +197,6 @@ let monTableau = {
|
|||
namecsv: {
|
||||
type: String,
|
||||
},
|
||||
namepdf: {
|
||||
type: String,
|
||||
},
|
||||
url_sort_asc: {
|
||||
type: String,
|
||||
},
|
||||
|
@ -710,13 +707,19 @@ let monTableau = {
|
|||
}
|
||||
},
|
||||
genererPDF(quoi = 'tableau') {
|
||||
let $tableau = [];
|
||||
Object.values(this[quoi]).forEach((d) => {
|
||||
$tableau.push(d.html);
|
||||
});
|
||||
|
||||
const data = {
|
||||
fichierpdf: this.fichierpdf,
|
||||
namepdf: this.namepdf,
|
||||
header: this.header,
|
||||
data: this[quoi],
|
||||
arg: this.argpdf,
|
||||
Tdata: $tableau,
|
||||
};
|
||||
|
||||
let req = $.ajax({
|
||||
url: this.pdfuri,
|
||||
type: 'POST',
|
||||
|
@ -815,18 +818,26 @@ let monTableau = {
|
|||
>
|
||||
<i class="fa fa-file-excel-o fas fa-file-csv" aria-hidden="true"></i>
|
||||
</button>
|
||||
<button class="btn" type="button" @click.stop="genererPDF()"
|
||||
v-show="this.fichierpdf"
|
||||
title="Générer le PDF du tableau affiché"
|
||||
>
|
||||
<i class="fas fa-file-pdf rouge" aria-hidden="true" alt="pdf"></i>
|
||||
</button>
|
||||
<button class="btn gamutable--exportCSV" type="button" @click.stop="exportCSV('table')"
|
||||
v-show="this.namecsv"
|
||||
title="Exporter le tableau complet en csv"
|
||||
>
|
||||
<i class="fas fas fa-file-excel" aria-hidden="true" alt="csv"></i>
|
||||
</button>
|
||||
<button class="btn" type="button" @click.stop="genererPDF()"
|
||||
|
||||
<button class="btn" type="button" @click.stop="genererPDF('table')"
|
||||
v-show="this.fichierpdf"
|
||||
title="Générer le PDF du tableau complet"
|
||||
>
|
||||
<i class="fas fa-file-pdf rouge" aria-hidden="true" alt="pdf"></i>
|
||||
<i class="far fa-file-pdf rouge" aria-hidden="true" alt="pdf"></i>
|
||||
</button>
|
||||
|
||||
<span v-show="chargement" class="rouge">
|
||||
<i class="fa fa-refresh fa-spin fa-fw rouge fas fa-sync fa-spin"></i>
|
||||
<span class="texteMajBDD">
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue