{[ "type": "checkbox", "label": "'.tr('Importa prima riga').'", "name": "first_row", "extra":"", "value": "1" ]}
'; // Inclusione del file del modulo per eventuale HTML personalizzato include $imports[$id_record]['import']; $fields = Import::getFields($id_record); $select = []; foreach ($fields as $key => $value) { $select[] = [ 'id' => $key, 'text' => $value['label'], ]; } $rows = Import::getFile($id_record, $records[0]['id'], [ 'limit' => 10, ]); $count = count($rows[0]); echo '
'; for ($column = 0; $column < $count; ++$column) { echo '

'.tr('Colonna _NUM_', [ '_NUM_' => $column + 1, ]).'

'; // Individuazione delle corrispondenze $selected = null; foreach ($fields as $key => $value) { //print_r($value); //echo $rows[0][$column]."
"; if (in_array($rows[0][$column], $value)) { $first_row = 1; $selected = $key; break; } } echo ' {[ "type": "select", "label": "'.tr('Campo').'", "name": "fields[]", "values": '.json_encode($select).', "value": "'.$selected.'" ]} '; foreach ($rows as $key => $row) { echo ' '; } echo '
'.tr('#').' '.tr('Valore').'
'.($key + 1).' '.$row[$column].'
'; } echo '
'; ?>