-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathselcot.php
More file actions
58 lines (47 loc) · 1.59 KB
/
Copy pathselcot.php
File metadata and controls
58 lines (47 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
require_once( "tools.php" );
function check_filename($fn)
{
$files = explorer( 'cotcot' );
return in_array($fn,$files);
}
/* Select a COTCOT from the list $_SESSION[ 'cotcotFiles' ] */
function scancot()
{
$files = explorer( 'cotcot' );
$liste = array();
foreach ($files as $key => $filename)
{
$DOMxml = new DOMDocument( '1.0', 'utf-8' );
$DOMxml->load( $filename );
$competXml = $DOMxml->documentElement;
$liste[$filename] = array
(
'TitreLong' => $competXml->getAttribute('TitreLong'),
'Categorie' => $competXml->getAttribute('Categorie'),
'Arme' => $competXml->getAttribute('Arme'),
'Sexe' => $competXml->getAttribute('Sexe'),
'Filename' => $filename
);
}
return $liste;
}
function selcot_table($liste)
{
$tbl = '<table class="liste_cots">';
$tbl .= '<tr><th>COTCOT</th><th>Titre</th><th>Sexe</th><th>Catégorie</th><th>Arme</th></tr>';
foreach ($liste as $filename => $data)
{
$href = "index.php?file=".urlencode($filename);
$js = "onclick=\"document.location='$href';\"";
// echo "HREF:$href<br>";
// echo "JS:$js<br>";
$tbl .= "<tr $js><td>" . $filename . '</td>';
$tbl .= '<td>'.$data['TitreLong'].'</td>';
$tbl .= '<td>'.$data['Sexe'].'</td>';
$tbl .= '<td>'.$data['Categorie'].'</td>';
$tbl .= '<td>'.$data['Arme'].'</td></tr>';
}
$tbl .= '</table>';
return $tbl;
}