Пример #1
0
$select_cat = new ISelect('fd_id');
$select_cat->value = $cn->make_array('select fd_id,fd_label from fiche_def where frd_id=' . FICHE_TYPE_CLIENT);
echo $select_cat->input();
echo HtmlInput::submit('display_prop', 'Afficher les propriétés');
echo '</FORM>';
// on choisit d'afficher les propriétés avant de confirmer l'import
// get parce qu'on interroge
if (isset($_GET['display_prop'])) {
    $a = new Fiche($cn);
    $prop = $a->to_array($_GET['fd_id']);
    foreach ($prop as $key => $value) {
        echo "Index : {$key} valeur {$value} <br/>";
    }
    echo '<form method="POST" action="extension.php"  enctype="multipart/form-data">';
    echo dossier::hidden();
    echo HtmlInput::extension();
    echo HtmlInput::hidden('fd_id', $_GET['fd_id']);
    $file = new IFile('fichier_csv');
    echo $file->input();
    echo HtmlInput::submit('start_import', 'Démarrez importation');
    echo '</form>';
    exit;
}
// Il est demandé de démarrer l'importation
// Post parce qu'on sauve
// On image que le fichier CSV n'a que 4 champs
// "nom client","prenom client", "numero client","adresse client"
//
if (isset($_POST['start_import'])) {
    $fd_id = $_POST['fd_id'];
    $tmp_file = $_FILES['fichier_csv']['tmp_name'];