Plugins  LAST
 All Data Structures Files Functions Variables Pages
test_file.php
Go to the documentation of this file.
1 
2 <?php
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 global $cn;
21 
22 ob_start();
23  /**
24  * Open the file and parse it
25  */
26 $fcard=fopen($filename,'r');
27 if ( $fcard == FALSE) {
28  printf(_("Erreur ouverture fichier %s "),$fcard);
29  return;
30 }
31 
33 $max=0;
34 
35 while (($row=fgetcsv($fcard,0,$delimiter,$surround)) !== false)
36  {
37  $row_count++;
38  echo '<tr style="border:solid 1px black">';
39  if ( $skip_row >= $row_count) echo td(_('Supprimé')); else echo td($row_count);
40  $count_col=count($row);
41  $max=($count_col>$max)?$count_col:$max;
42  for ($i=0;$i<$count_col;$i++)
43  {
44  echo td($row[$i],'style="border:solid 1px black"');
45  }
46  echo '</tr>';
47  }
48 $table=ob_get_contents();
49 ob_end_clean();
50 
51 echo '<table style="border:solid 1px black;width:100%">
52 <tr>';
53 
54 /**
55  *create widget column header
56  */
57 
58 
59 echo th('Numéro de ligne');
60 $nb_attribute = count($a_attribute);
61 $nb_header=count($a_header);
62 for ($i=0;$i<$max;$i++)
63  {
64  if ($i >= $nb_header)
65  $header->selected=-1;
66  else
67  {
68  if ( in_array($a_header[$i],$a_valid_header) )
69  $header->selected=$a_header[$i];
70  else
71  $header->selected=-1;
72  }
73  echo '<th>'.$header->input().'</th>';
74  }
75 echo '</tr>';
76 echo $table;
77 echo '</table>';
78 ?>
79 </form>
$max
Definition: test_file.php:33
if($fcard==FALSE) $row_count
Definition: test_file.php:32
for($i=0;$i< Database::num_row($ret);$i++) $row
$header
$skip_row
$nb_attribute
create widget column header
Definition: test_file.php:60
global $cn
Definition: test_file.php:20
while(($row=fgetcsv($fcard, 0, $delimiter, $surround))!==false) $table
Definition: test_file.php:48
$nb_header
Definition: test_file.php:61
$fcard
Open the file and parse it.
Definition: test_file.php:26