-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arbre_Perso.php
157 lines (151 loc) · 4.25 KB
/
Arbre_Perso.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
//=====================================================================
// Affichage d'un arbre personnalisé
// (c) Gérard KESTER
// UTF-8
//=====================================================================
session_start();
include('fonctions.php');
$acces = 'L'; // Type d'accès de la page : (M)ise à jour, (L)ecture
$titre = $LG_Menu_Title['Pers_Tree']; // Titre pour META
$x = Lit_Env();
include('Gestion_Pages.php');
//
// Lecture des paramètres passés
// Si Refer = 0 => appel direct de la page, sans avoir beson de la calculer
$nomArbre = Recup_Variable('nomArbre','S');
$reference = Recup_Variable('Refer','S');
//
if ($nomArbre != '')
{
$nomArbre = rawurldecode($nomArbre);
}
//
// Vérification s'il n'y a pas de personnes non diffusables sur Internet
$sql = 'SELECT COUNT(*) AS nbPers FROM '.nom_table('arbrepers') . ' AS ap, ' .
nom_table('personnes') . ' AS p, ' .
nom_table('arbre') . ' AS a' .
' WHERE ap.reference = p.reference AND ap.idArbre = a.idArbre AND a.nomFichier = \'' . $nomArbre . '\'' .
' AND p.Diff_Internet <> \'O\'';
$res = lect_sql($sql);
$row = $res->fetch(PDO::FETCH_NUM);
$nbPers = $row[0];
if ($nbPers > 0 AND !$_SESSION['estPrivilegie'])
{
echo aff_erreur(LG_PERS_TREE_ERROR_NO_SHOW).'<br />' .
'<a href="' . Get_Adr_Base_Ref() . '">'.my_html($LG_back_to_home).'</a><br />';
return 0;
}
//
Insere_Haut($titre,'','Arbre_Perso','');
//
$style_fond = 'style="background-image:url(\''.$chemin_images.'bar_off.gif\');background-repeat:repeat-x;"';
//
if ($reference == 0)
{
$nomFichierHtml = $nomArbre;
$position = strpos($nomArbre , "_");
if ($position)
{
$nomArbre = substr($nomArbre , 0 , $position);
}
}
//
// Lecture du nom du répertoire
$sql = 'SELECT valeur FROM '.nom_table('arbreparam')
. ' WHERE ident1 = \'repertoire\' AND ident2 = \'genImg\'';
$res = lect_sql($sql);
if ($row = $res->fetch(PDO::FETCH_NUM))
{
$rep = $row[0];
}
else
{
echo my_html(LG_PERS_TREE_MISSING_DIR) . '<br />';
exit;
}
// Lecture des caractéristiques de l'arbre
$sql = 'SELECT * FROM '.nom_table('arbre')
. ' WHERE nomFichier = \'' . $nomArbre . '\'';
$res = lect_sql($sql);
$idArbre = 0;
if ($row = $res->fetch(PDO::FETCH_ASSOC))
{
$largPage = $row['largeurPage'];
$hautPage = $row['hauteurPage'];
$idArbre = $row['idArbre'];
$descArbre = $row['descArbre'];
$nbPagesHor = $row['nbPagesHor'];
$nbPagesVer = $row['nbPagesVer'];
}
else
{
echo my_html(LG_PERS_TREE_MISSING_ROW) . $nomArbre . '<br />';
exit;
}
// Lecture de la position de la personne
if ($reference > 0)
{
$sql = 'SELECT * FROM '.nom_table('arbrepers') . ' WHERE idArbre = \'' . $idArbre . '\' AND reference = '.$reference;
$posX = 0; // Abscisse de la personne
$posY = 0; // Ordonnée de la personne
$numPageH = 0; // Numéro de page horizontale
$numPageV = 0; // Numéro de page verticale
$res = lect_sql($sql);
if ($row = $res->fetch(PDO::FETCH_ASSOC))
{
$posX = $row['posX'] * 0.75;
$posY = $row['posY'] * 0.75;
$numPageH = intval($posX / $largPage);
$numPageV = intval($posY / $hautPage);
}
$nomFichierHtml = $rep . '/' . $nomArbre . '_' .$numPageV . '_' .$numPageH . '.html';
}
else
{
$nomFichierHtml = $rep . '/' . $nomFichierHtml;
}
// Affichage du nom du fichier
echo '<h2> ' . $descArbre . '</h2>' . "\n";
// Liste de choix de la page
if ($nbPagesHor * $nbPagesVer > 1)
{
$numPage = 1;
echo '<form method="get" action="">' . "\n";
echo '<select onchange="document.location = this.options[this.selectedIndex].value;">' . "\n";
echo '<option>'.my_html(LG_PERS_TREE_CHOOSE_OTHER).'</option>' . "\n";
for ($indV = 0 ; $indV < $nbPagesVer ; $indV ++)
{
for ($indH = 0 ; $indH < $nbPagesHor ; $indH ++)
{
$Url = rawurlencode($nomArbre . '_' .$indV . '_' .$indH);
echo '<option value="Arbre_Perso.php?nomArbre=' . $Url . '.html&Refer=0">Page ' . $numPage . '</option>' . "\n";
$numPage ++;
}
}
echo "</form></select><p>\n";
}
//
if (file_exists($nomFichierHtml))
{
if ($wFic = fopen ($nomFichierHtml , 'r'))
{
while (!feof($wFic))
{
$ligne = fgets($wFic);
echo trim($ligne) . "\n";
}
}
else
{
echo my_html(LG_PERS_TREE_OPEN_ERROR) . $nomFichierHtml . "<br />";
}
}
else
{
echo my_html(LG_PERS_TREE_NOT_FOUND) . LG_SEMIC . $nomFichierHtml . "<br />";
}
Insere_Bas('');
?>
</body>
</html>