download structures.php
Language: PHP
License: GPL
Copyright: (C) 2002 Loc Dayot - Mairie de Pierrefitte (93)
LOC: 354
Project Info
epnadmin
Server: Savannah NonGNU
Type: cvs
...epnadmin\epnadmin\epnadmin\
   6cartes.inc.php
   add_message.sh
   add_message_file.sh
   animateur.php
   ...eurs-disponibilites.php
   animateurs-horaires.php
   animateurs.inc.php
   autoeval.js
   barcode.inc.php
   basdepage.inc.php
   camembert.inc.php
   cartes.inc.php
   common.initial.sql
   config.php
   configuration.php
   constantes.inc.php
   courriel.php
   dateheure.inc.php
   debug.inc.php
   domaines.php
   en.lang.inc.php
   entete.inc.php
   epnadmin.css
   epnadminv.css
   exemple.sql
   fonctions.inc.php
   footer.inc.php
   fr.initial.sql
   fr.lang.inc.php
   header.inc.php
   horaires.php
   i25object.inc.php
   image.inc.php
   index.php
   initial.sql
   initiations.inc.php
   initiations.php
   inscription_session.php
   localisations.php
   logiciels.php
   materiels.php
   menu2.js
   mysql.inc.php
   parcours.inc.php
   parcours.php
   positionnement.php
   prets.php
   print.php
   questions.php
   remove_message.sh
   reservations.inc.php
   reservations.php
   session.php
   sessions.inc.php
   siteweb.inc.php
   siteweb.php
   stats.php
   structure.sql
   structures.inc.php
   structures.php
   table_horaire.php
   table_horaire_session.php
   tableaux.inc.php
   tarifs.php
   themes.php
   usagers.inc.php
   usagers.php
   usages.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<?php
/*
    Copyright (C) 2002 Loc Dayot - Mairie de Pierrefitte (93)

    EPNadmin - Version 0.6

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    http://epnadmin.pierrefitte93.fr/
*/

require_once("header.inc.php");
if (! defined("FCT_STRUCTURES"))
{
	echo $fctnonactive;
	exit;
}

require_once("constantes.inc.php");             // dfinition des constantes
//require_once("fonctions.inc.php");              // concernant des fonctions transversales inclassables
require_once("mysql.inc.php");                  // concernant mysql
//require_once("sessions.inc.php");             // concernant les sessions et initiations
//require_once("usagers.inc.php");              // concernant la gestion des usagers
//require_once("reservations.inc.php");         // concernant les rservations des postes en accs individuel par des usagers
//require_once("tableaux.inc.php");             // Concernant l'affichage transpos d'un tableau
//require_once("siteweb.inc.php");              // concernant les pages perso des usagers et les sites web des structures
//require_once("dateheure.inc.php");            // concernant la manipulation des heures et des dates, formulaire, conversion...
require_once("structures.inc.php");           // concernant les structures
//require_once("initiations.inc.php");          // concernant les initiations et les thmes
//require_once("parcours.inc.php");             // concernant les parcours des usagers et leur positionnement

$ptitr=$sstructures;
$titr=$sstrutitre;
define("COULEUR", COULEUR_STRUCTURES);
$datemaj="3 mai 2003";
require("entete.inc.php");

// Affiche les informations concernant une structure
function affiche_structure($id_stru)
{
global $id_structure,
	$pasledroit;
  $res=recherche("structures", "id", $id_stru);
  $structure=fetch_object($res);
  echo "<table border=1 align=center>
        <tr><th align=center colspan=2>$structure->structure</th></tr>
        <tr><td>Raison sociale :</td><td>$structure->raison_sociale</td></tr>
        <tr><td>Responsable :</td><td>$structure->nom_responsable</td></tr>
        <tr><td>Adresse :</td><td>$structure->adresse</td></tr>
        <tr><td>Ville :</td><td>$structure->ville</td></tr>
        <tr><td>Courriel :</td><td>$structure->courriel</td></tr>
        <tr><td>Site web :</td><td>$structure->siteweb</td></tr>\n";
  if (STRUCTURES_AUTRES>="r")
     echo "<tr><td>Commentaire :</td><td>$structure->commentaires</td></tr>";
  echo "</table>\n";
}

function verifiedroits($acces="r", $id_stru, $affiche=TRUE)
{
global $id_structure, $pasledroit;
	if (STRUCTURES_MOI>=$acces && $id_stru==$id_structure)
		return TRUE;
	if (STRUCTURES_AUTRES>=$acces)
		return TRUE;
	if ($affiche) echo $pasledroit;
	return FALSE;
}

// Dbut du contenu de la page

if (STRUCTURES<="~")
{
  echo $pasledroit;
  exit;
}

if (!$id_stru)
  $id_stru=$id_structure;

switch($operation)
{
case 61 : // Enregistrement du changement de mot de passe de l'usager
	echo cadre_debut($schagnementmdp);
  if (! verifiedroits("w", $id_stru))
	{
		echo cadre_fin();
    break;
	}
  $mes="";
  if ((!$motdepasse || $motdepasse=="") && $id_structure==$id_stru)
    $mes .= $smanquemotdepasseactuel."<br>";
  $res=recherche("structures", "id", $id_stru);
  if (! $structure=fetch_object($res))
    $mes.="$sstructureintrouvable<br>";
  // vrifier que l'ancien mot de passe est bien le bon
  //         uniquement si on n'est pas administrateur
  if ($id_structure==$id_stru && $motdepasse!=$structure->motdepasse
                        && md5($motdepasse)!=$structure->motdepasse) 
		$mes.="$smauvaismotdepasse<br>";
  if ($motdepasse1=="" || $motdepasse2=="") $mes .= "$manquemotdepasse<br>";
  if ($motdepasse1 != $motdepasse2) $mes .= "$motdepassedifferents<br>";
  if ($mes!="")
    echo "<p>$mes</p>";
  else
  {
    // modification du compte de structure dans la base locale epnadmin
    echo "<p>$schgmdpstruok</p>";
    $motdepassec=md5($motdepasse1);
    $query = "UPDATE structures SET motdepasse='$motdepassec' WHERE id='$id_stru'";
    $result = executeRequete($query);
		echo cadre_fin();
    break;
  }
	echo cadre_fin();

case 6 : // Une structure demande  changer de mot de passe
	echo cadre_debut($schagnementmdp);
  if (! verifiedroits("w", $id_stru))
	{
		echo cadre_fin();
    break;
	}
  $res=recherche("structures", "id", $id_stru);
  if (! $structure=fetch_object($res))
	{
    echo "<p>$sstructureintrouvable</p>";
		break;
	}
  echo "<form name=\"form_mp_structure\" method=\"post\" action=\"$PHP_SELF\">
      <input type=\"hidden\" name=\"id_stru\" value=\"$id_stru\">
      <input type=\"hidden\" name=\"operation\" value=\"61\">
      <table border=\"1\">
      <tr><th align=center colspan=2>$schangementmpd ".structure($id_stru)." ($structure->login)</th></tr>";
  // Si on est administrateur, on ne demande pas le mot de passe en cours
  if ($id_structure==$id_stru)
    echo "<tr><td>$smotdepasseactuel*</td><td><input type=\"password\" name=\"motdepasse\"></td></tr>";
  echo "<tr><td>$smotdepassenouveau*</td>
						<td><input type=\"password\" name=\"motdepasse1\"></td></tr>
        <tr><td>$smotdepassenouveau* ($sconfirmer)</td>
						<td><input type=\"password\" name=\"motdepasse2\"></td></tr>
        <tr><td align=center colspan=2><input type=\"submit\" value=\"$sconfirmer\"></td></tr>
        <tr><td colspan=2>$savertissementmdpstru</td></tr>
        </table></form>\n";
	echo cadre_fin();
  break;

  case 3 : // Confirmation d'effacement
		echo cadre_debut($sstruefface);
    if (! verifiedroits("w", $id_stru))
		{
			echo cadre_fin();
      break;
		}
    $mes="";
    if ($id_stru==$id_structure)
      $mes.=$struestmoi;
    $res = recherche("sessions", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertsession;
    $res = recherche("localisations", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertlocal;
    $res = recherche("animateurs", "id_structure_provenance", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertanimateur;
    $res = recherche("usagers", "id_structure_provenance", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertusagers;
    $res = recherche("pret_materiel", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertpret;
    if ($mes!="")
    {
      echo $mes;
			echo cadre_fin();
      break;
    }
    echo "<form name=\"form\" method=\"post\" action=\"structures.php\">
            <input type=\"hidden\" name=\"id_stru\" value=\"$id_stru\">
            <input type=\"hidden\" name=\"operation\" value=\"31\">
          <b>$sconfirmersupprstru ";
    echo structure($id_stru);
    echo " ?</b>
          <br><input type=\"submit\" action=\"structures.php\" name=\"Annuler\" value=\"$ssupprsuppr\">
        </form>\n";
		echo cadre_fin();
    break;

  case 31:  // Efface final
		echo cadre_debut($sstruefface);
    if (! verifiedroits("w", $id_stru))
		{
			echo cadre_fin();
      break;
		}
    $mes="";
    $res = recherche("sessions", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertsession;
    $res = recherche("localisations", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertlocal;
    $res = recherche("animateurs", "id_structure_provenance", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertanimateur;
    $res = recherche("usagers", "id_structure_provenance", $id_stru);
    if (fetch_object($res))
      $mes.=$strusertusagers;
    $res = recherche("pret_materiel", "id_structure", $id_stru);
    if (fetch_object($res))
      $mes.=$struserthebergement;
    if ($mes!="")
    {
      echo $mes;
			echo cadre_fin();
      break;
    }
    $query = "DELETE FROM structures WHERE id='$id_stru'";
    if (executeRequete($query))
    	echo "<p>$sstrueffacee</p>";

    $query = "DELETE FROM droits WHERE id_structure='$id_stru'";
    if (executeRequete($query))
			echo "<p>$sstrudroitseffaces</p>";
		echo cadre_fin();
    break;

  case 2:   // Formulaire modification
		echo cadre_debut($smaj);
    if (! verifiedroits("w", $id_stru))
		{
			echo cadre_fin();
			break;
		}
    $result = recherche("structures", "id", $id_stru);
    $u=fetch_array($result);
    $operation=21;
    extract($u);
    // pas de break

  case 1:  // Ajoute un nouveau partenaire (ou le modifie)
    if ($operation==1)
    {
			echo cadre_debut($sajoutstru);
      if (! verifiedroits("w", $id_stru))
        break;
      $operation=11;
      $structure="";
      $login="";
    }
    echo "<table align=center border=1>
          <form name=\"modistru\" method=\"post\" action=\"structures.php\">\n";
    if ($operation==21)
        echo "<input type=\"hidden\" name=\"id_stru\" value=\"$id_stru\">\n";
    echo "<input type=\"hidden\" name=\"operation\" value=\"$operation\">
          <tr><td>$sStructure* :</td><td><input type=\"text\" name=\"structur\" value=\"$structure\" size=\"32\" maxlength=\"30\"></td></tr>
          <tr><td>$sRaisonsociale :</td><td><input type=\"text\" name=\"raison_sociale\" value=\"$raison_sociale\" size=\"50\" maxlength=\"50\"></td></tr>
          <tr><td>$sNomresponsable :</td><td><input type=\"text\" name=\"nom_responsable\" value=\"$nom_responsable\" size=\"32\" maxlength=\"50\"></td></tr>
          <tr><td>$sIdentifiant* :</td><td>";
    //if ($operation==11)
      echo "<input type=\"text\" name=\"login\" value=\"$login\" size=\"32\" maxlength=\"30\">";
    //else
      //echo "<i>non modifiable</i>";
    echo "</td></tr>
          <tr><td>$sMotdepasse* :</td><td>";
    if ($operation==21)
      echo "<a href=\"$PHP_SELF?operation=6&id_stru=$id_stru\">$slemodifier</a>";
    else
      echo "<input type=\"password\" name=\"motdepasse\" value=\"\" size=\"32\" maxlength=\"32\"><br>
            <input type=\"password\" name=\"motdepasse2\" value=\"\" size=\"32\" maxlength=\"32\">";
    echo "</td></tr>
          <tr><td>$sAdresse :</td><td><input type=\"text\" name=\"adresse\" value=\"$adresse\" size=\"32\" maxlength=\"100\"></td></tr>
          <tr><td>$sVille* :</td><td><input type=\"text\" name=\"ville\" value=\"$ville\" size=\"32\" maxlength=\"50\"></td></tr>
          <tr><td>$sCourrieldefaut :<br>(dj existant)</td><td><input type=\"text\" name=\"courriel\" value=\"$courriel\" size=\"32\" maxlength=\"50\"></td></tr>
          <tr><td>$sSitewebdefaut :<br>(dj existant)</td><td><input type=\"text\" name=\"siteweb\" value=\"$siteweb\" size=\"32\" maxlength=\"50\"></td></tr>
          <tr><td>$sCommentaires :</td><td><textarea name=\"commentaires\" rows=\"4\" cols=\"60\">$commentaires</textarea>\n";
    echo "<tr><td align=center colspan=2>
          <input type=\"submit\" name=\"Envoyer\" value=\"$envoyer\">
          </td></tr></table></form>\n";
		echo cadre_fin();
    break;

  case 11:  // Ajout final
		echo cadre_debut($sajoutstru);
    if (! verifiedroits("w", $id_stru))
		{
      echo cadre_fin();
			break;
		}
    // vrification des paramtres
    $res=recherche("structures", "login", $login);
		$mes="";
    if (fetch_object($res))
      $mes.=$logindejapris;
    // TODO : plein de choses  vrifier...
		if ($mes!="")
		{
			echo $mes;
			echo cadre_fin();
			break;
		}
    $query = "INSERT INTO structures
                        (structure,raison_sociale,nom_responsable,login,motdepasse,
                        adresse,ville,courriel,siteweb,commentaires,
                        date )
                VALUES (\"$structur\", \"$raison_sociale\", \"$nom_responsable\",
                        \"$login\", \"$motdepasse\", \"$adresse\", \"$ville\",
                        \"$courriel\", \"$siteweb\", \"$commentaires\",
                        NOW())";
    if (executeRequete($query))
      echo "<p>$sstruajoutee</p>";
		echo cadre_fin();
    break;

  case 21:  // Modif finale
		echo cadre_debut($smaj);
    if (! verifiedroits("w", $id_stru))
      break;
    $query = "UPDATE structures SET
                    structure=\"$structur\", raison_sociale=\"$raison_sociale\",
                    nom_responsable=\"$nom_responsable\",
                    adresse=\"$adresse\", ville=\"$ville\",
                    courriel=\"$courriel\", siteweb=\"$siteweb\",
                    commentaires=\"$commentaires\"
                WHERE id=\"$id_stru\"";
    if ($result = executeRequete($query))
      echo "<p>$sstrumaj</p>";
		echo cadre_fin();
    break;

  case 5 : // liste des structures
		echo cadre_debut($slistestructures, "align=center", COULEUR_STRUCTURES);

    if (STRUCTURES_AUTRES<"r")
    {
      echo $pasledroit;
			echo cadre_fin(COULEUR_STRUCTURES);
      break;           
    }
    $req = "SELECT * FROM structures ORDER BY structure";
    $res = executeRequete($req);
    echo "<table align=center border=1>";
    //      <tr><td colspan=6><h3 align=center>Liste des partenaires</h3></td></tr>\n";
    while ($u= fetch_object($res))
    {
      echo "<tr><td><b>$u->structure</b><br>$u->raison_sociale</td>
                <td>$u->nom_responsable<br>$u->adresse<br><a href=\"mailto:$u->courriel\">$u->courriel</a></td>
                <td>".nl2br($u->commentaires)."</td>
                <td><a href=\"structures.php?id_stru=$u->id\">$info</a></td>";
      if (verifiedroits("w", $u->id, FALSE)) // on ne peut pas se dtruire
        echo "  <td><a href=\"structures.php?operation=2&id_stru=$u->id\">$modifier</a></td>\n";
      if (verifiedroits("w", $u->id, FALSE) && $u->id!=$id_structure) // on ne peut pas se dtruire
        echo "  <td><a href=\"structures.php?operation=3&id_stru=$u->id\">$supprimer</a></td>";
      echo "</tr>\n";
    }
    if (STRUCTURES_AUTRES>="w")
      echo "<tr><td colspan=6 align=right><a href=\"structures.php?operation=1\">$ajouter</a></td></tr>\n";
    echo "</table>\n";
		echo cadre_fin(COULEUR_STRUCTURES);
    break;

  default : // infos sur une structure
    if (!$id_stru) $id_stru=$id_structure;
    if (! verifiedroits("r", $id_stru))
      break;
		echo cadre_debut($sdetailstructure, "align=center", COULEUR_STRUCTURES);

/*    echo "<table align=center bgcolor=\"".COULEUR_STRUCTURE."\">
          <tr><td align=center><font size=\"+2\">Informations sur une structure</font></td></tr>
          <tr><td align=center>\n"; */
    affiche_structure($id_stru);
    //echo "</td></tr></table>\n";
    if (verifiedroits("w", $id_stru, FALSE))
      echo "<p align=center><a href=\"$PHP_SELF?operation=2&id_stru=$id_stru\">$modifier Modifier des informations</a></p>\n";
    if (STRUCTURES_AUTRES>="w" && $id_structure!=$id_stru)  // On ne peut pas se dtruire soi mme.
      echo "<p align=center><a href=\"$PHP_SELF?operation=3&id_stru=$id_stru\">$supprimer Supprimer la structure</a></p>\n";
		echo cadre_fin(COULEUR_STRUCTURES);

    if (defined("FCT_LOCALISATIONS")
        && (  (LOCALISTIONS_MOI>="r" && $id_stru==$id_structure)
          || LOCALISATIONS_AUTRES>="r"))
    {
      // Affichage des localisations
      $req = "SELECT * FROM localisations";
      $req.=" WHERE id_structure=$id_stru";
      $req.=" ORDER BY id_structure, salle";
      $res = executeRequete($req);

      echo cadre_debut($slistelocalisations, "align=center", COULEUR_LOCALISATIONS);
			echo "<table align=center border=1>\n";
      while ($u=fetch_object($res))
      {
        echo "<tr><td>".localisation($u->id, TRUE)."</td>";
        if ((LOCALISATIONS_MOI>="w" && $id_structure==$id_stru) || LOCALISATIONS_AUTRES>="w")
          echo "  <td><a href=\"localisations.php?operation=2&id_localisation=$u->id\">$modifier</a></td>
                  <td><a href=\"localisations.php?operation=3&id_localisation=$u->id\">$supprimer</a></td>";
        echo "</tr>\n";
      }
      if ((LOCALISATIONS_MOI>="w" && $id_structure==$id_stru) || LOCALISATIONS_AUTRES>="w")
        echo "<tr><td colspan=3 align=right><a href=\"localisations.php?operation=1&id_stru=$id_stru\">$ajouter</a></td></tr>\n";
      echo "</table>";
			echo cadre_fin(COULEUR_LOCALISATIONS);
    }
    break;

  }  // switch

if (LOCALISATIONS_AUTRES>="r")
  echo "<p><a href=\"structures.php?operation=5\">$slistestructures</a>.</p>\n";
else
  echo "<p><a href=\"structures.php\">$sinfomastructure</a>.</p>\n";

include("basdepage.inc.php");
echo "</body></html>\n";
require("footer.inc.php");
?>

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us