|
|
|
@ -65,6 +65,7 @@ class table {
|
|
|
|
|
} else { |
|
|
|
|
$this->champs = \unserialize($formulaire_detail['saisies']); |
|
|
|
|
} |
|
|
|
|
$this->champs = \saisies_mapper_option($this->champs, ['data_rows', 'data_cols'], 'saisies_chaine2tableau'); |
|
|
|
|
// Afficher les ip ? |
|
|
|
|
if (lire_config('formidable/exporter_adresses_ip')) { |
|
|
|
|
$this->ip = true; |
|
|
|
@ -113,16 +114,30 @@ class table {
|
|
|
|
|
$columns[] = 'natif-ip'; |
|
|
|
|
} |
|
|
|
|
foreach ($this->cextras_finaux as $extra) { |
|
|
|
|
if ($extra['saisie'] == 'explication') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$columns[] = 'extra-'.$extra['options']['nom']; |
|
|
|
|
$columns = array_merge($columns, |
|
|
|
|
pipeline('formidable_ts_column', |
|
|
|
|
[ |
|
|
|
|
'data' => [], |
|
|
|
|
'args' => [ |
|
|
|
|
'type' => 'extra', |
|
|
|
|
'saisie' => $extra |
|
|
|
|
] |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
foreach ($this->champs_finaux as $champ) { |
|
|
|
|
if ($champ['saisie'] == 'explication') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$columns[] = 'champ-'.$champ['options']['nom']; |
|
|
|
|
$columns = array_merge($columns, |
|
|
|
|
pipeline('formidable_ts_column', |
|
|
|
|
[ |
|
|
|
|
'data' => [], |
|
|
|
|
'args' => [ |
|
|
|
|
'type' => 'champ', |
|
|
|
|
'saisie' => $champ |
|
|
|
|
] |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
// Ajouter les nouvelles colonnes à la fin, et soustraire celles qui n'existent plus |
|
|
|
|
$diff = array_diff($columns, $order); |
|
|
|
@ -145,6 +160,11 @@ continue;
|
|
|
|
|
$headers = &$this->headers; |
|
|
|
|
foreach ($this->columns as $column) { |
|
|
|
|
list($type, $nom) = explode('-', $column); |
|
|
|
|
if (strpos($nom, '@@@')) { |
|
|
|
|
list($nom, $sous_nom) = explode('@@@', $nom); |
|
|
|
|
} else { |
|
|
|
|
$sous_nom = ''; |
|
|
|
|
} |
|
|
|
|
if ($type === 'natif') { |
|
|
|
|
if ($nom === 'statut') { |
|
|
|
|
$headers[] = new header([ |
|
|
|
@ -190,6 +210,9 @@ continue;
|
|
|
|
|
$fieldset = ''; |
|
|
|
|
} |
|
|
|
|
$label = $saisie['options']['label'] ?? $saisie['options']['label_case'] ?? $saisie['options']['nom']; |
|
|
|
|
if (isset($saisie['options']['data_rows'])) { |
|
|
|
|
$label .= ' — '. $saisie['options']['data_rows'][$sous_nom]; |
|
|
|
|
} |
|
|
|
|
if ($fieldset) { |
|
|
|
|
$label .= " <span class='fieldset_label'>($fieldset)</span>"; |
|
|
|
|
} |
|
|
|
@ -224,6 +247,18 @@ continue;
|
|
|
|
|
$this->totalRows++; |
|
|
|
|
foreach ($this->columns as $column) { |
|
|
|
|
list($type, $nom) = explode('-', $column); |
|
|
|
|
if (strpos($nom, '@@@')) { |
|
|
|
|
list($nom, $sous_nom) = explode('@@@', $nom); |
|
|
|
|
} else { |
|
|
|
|
$sous_nom = ''; |
|
|
|
|
} |
|
|
|
|
$args_pipeline = [ |
|
|
|
|
'id_formulaire' => $this->id_formulaire, |
|
|
|
|
'id_formulaires_reponse' => $id_formulaires_reponse, |
|
|
|
|
'nom' => $nom, |
|
|
|
|
'sous_nom' => $sous_nom, |
|
|
|
|
'type' => $type |
|
|
|
|
]; |
|
|
|
|
if ($type === 'natif') { |
|
|
|
|
if ($nom === 'statut') { |
|
|
|
|
$value = \liens_absolus(\appliquer_filtre($row_reponse['statut'], 'puce_statut', 'formulaires_reponse', $row_reponse['id_formulaires_reponse'], true)); |
|
|
|
@ -277,6 +312,7 @@ continue;
|
|
|
|
|
} else { |
|
|
|
|
if ($type === 'extra') { |
|
|
|
|
$champ = $this->cextras_finaux_par_nom[$nom]; |
|
|
|
|
$args_pipeline['saisie'] = $champ; |
|
|
|
|
$crayons = false; |
|
|
|
|
$nom = $champ['options']['nom']; |
|
|
|
|
if (test_plugin_actif('crayons')) { |
|
|
|
@ -295,6 +331,13 @@ continue;
|
|
|
|
|
} else { |
|
|
|
|
$value = implode(\calculer_balise_LISTER_VALEURS('formulaires_reponses', $nom, $row_reponse[$nom]), ', '); |
|
|
|
|
} |
|
|
|
|
$value = pipeline( |
|
|
|
|
'formidable_ts_cell_value', |
|
|
|
|
[ |
|
|
|
|
'data' => $value, |
|
|
|
|
'args' => $args_pipeline |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
$row_ts[] = new cell( |
|
|
|
|
[ |
|
|
|
|
'table' => $this, |
|
|
|
@ -308,9 +351,27 @@ continue;
|
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
} else { // Réponse de l'internaute |
|
|
|
|
$champ = $this->champs_finaux_par_nom[$nom]; |
|
|
|
|
$args_pipeline['saisie'] = $champ; |
|
|
|
|
|
|
|
|
|
$value = \calculer_voir_reponse($id_formulaires_reponse, $this->id_formulaire, $nom, '', 'valeur_uniquement'); |
|
|
|
|
$value = pipeline( |
|
|
|
|
'formidable_ts_cell_value', |
|
|
|
|
[ |
|
|
|
|
'data' => $value, |
|
|
|
|
'args' => $args_pipeline |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$value_raw = \calculer_voir_reponse($id_formulaires_reponse, $this->id_formulaire, $nom, '', 'brut'); |
|
|
|
|
$champ = $this->champs_finaux_par_nom[$nom]; |
|
|
|
|
$value_raw = pipeline( |
|
|
|
|
'formidable_ts_cell_value_raw', |
|
|
|
|
[ |
|
|
|
|
'data' => $value_raw, |
|
|
|
|
'args' => $args_pipeline |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$row_ts[] = new cell( |
|
|
|
|
[ |
|
|
|
|
'table' => $this, |
|
|
|
@ -435,6 +496,7 @@ class cell implements \JsonSerializable{
|
|
|
|
|
private $table; |
|
|
|
|
private $id_formulaires_reponse; |
|
|
|
|
private $nom; |
|
|
|
|
private $sous_nom; |
|
|
|
|
private $value; |
|
|
|
|
private $sort_value; |
|
|
|
|
private $filter_value; |
|
|
|
@ -445,6 +507,7 @@ class cell implements \JsonSerializable{
|
|
|
|
|
$this->table = $param['table'] ?? false; |
|
|
|
|
$this->id_formulaires_reponse = $param['id_formulaires_reponse'] ?? false; |
|
|
|
|
$this->nom = $param['nom']; |
|
|
|
|
$this->sous_nom = $param['sous_nom'] ?? ''; |
|
|
|
|
$this->value = $param['value']; |
|
|
|
|
$this->sort_value = $param['sort_value'] ?? \textebrut($this->value); |
|
|
|
|
if (function_exists('mb_strtolower')) { |
|
|
|
@ -492,7 +555,10 @@ class header extends cell {
|
|
|
|
|
* Returne la valeur string, avec le span englobant, pour les crayons |
|
|
|
|
**/ |
|
|
|
|
public function jsonSerialize(): string { |
|
|
|
|
$data_col = "$this->type-$this->nom"; |
|
|
|
|
$data_col = $this->nom; |
|
|
|
|
if ($this->sous_nom) { |
|
|
|
|
$data_col .= '@@@'.$this->sous_nom; |
|
|
|
|
} |
|
|
|
|
$arrows = "<div data-col='$data_col' class='move-arrows'><a class='left'>⬅</a> <a class='right'>➡</a></div>"; |
|
|
|
|
return "$arrows\n\r<div class='header-title'>$this->value</div>"; |
|
|
|
|
} |
|
|
|
@ -510,6 +576,7 @@ function formidable_ts_json($env) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Appelle le pipeline formidable_ts_sort_value |
|
|
|
|
* Pour trouver le type de tri |
|
|
|
|