A
download localisations.php
Language: PHP
License: GPL
Copyright: (C) 2002 Loc Dayot - Mairie de Pierrefitte (93)
LOC: 246
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
<?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");
require_once("constantes.inc.php");             // dfinition des constantes
if (! defined("FCT_LOCALISATIONS"))
{
	echo $fctnonactive;
	exit;
}

//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=$slocalisations;
$titr = $stitrelocalisations;
$datemaj="3 mai 2003";
define("COULEUR", COULEUR_LOCALISATIONS);
require("entete.inc.php");

function verifiedroits($droit="r", $affichage=true)
{
global $id_localisation, $id_structure,
  $pasledroit, $localisationintrouvable, $manqueinforlocalisation;
  if (!$id_localisation)
  {
    if ($affichage)
      echo $manqueinfolocalisation;
    return FALSE;
  }
  $req="SELECT id_structure FROM localisations
          WHERE id=\"$id_localisation\"";
  $res=executeRequete($req);
  if (! $localisation=fetch_object($res))
  {
    if ($affichage)
      echo $localisationintrouvable;
    return FALSE;
  }
  if (! (LOCALISATIONS_AUTRES>=$droit || (LOCALISATIONS_MOI>=$droit && $localisation->id_structure==$id_structure)))
  {
    if ($affichage)
      echo $pasledroit;
    return FALSE;
  }
  return TRUE;
}


// Dbut du contenu de la page

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

switch($operation)
{
case 3 : // Confirmation d'effacement
	echo cadre_debut($slocalsuppr);
  if (! verifiedroits("w"))
	{
		echo cadre_fin();
    break;
	}
  $mes="";
  $res = recherche("materiels", "id_localisation", $id_localisation);
  if (fetch_object($res))
    $mes.=$localsertmateriel;
  $res = recherche("sessions", "id_localisation", $id_localisation);
  if (fetch_object($res))
    $mes.=$localsertsession;
  if ($mes!="")
  {
    echo $mes;
		echo cadre_fin();
    break;
  }

  echo "<table align=center>
          <form name=\"form\" method=\"post\" action=\"localisations.php\">
            <input type=\"hidden\" name=\"id_localisation\" value=\"$id_localisation\">
            <input type=\"hidden\" name=\"operation\" value=\"31\">
            <tr><td><b>$slocalconfirmesuppr ";
  echo localisation($id_localisation, TRUE);
  echo " ?</b></td></tr>
          <tr><td><input type=\"submit\"
              name=\"Annuler\" value=\"$confirmer\"></td></tr>
        </form>
      </table>\n";
	echo cadre_fin();
  break;

case 31:  // Efface final
	echo cadre_debut($slocalsuppr);
  if (! verifiedroits("w"))
	{
		echo cadre_fin();
    break;
	}
  $mes="";
  $res = recherche("materiels", "id_localisation", $id_localisation);
  if (fetch_object($res))
    $mes.=$localsertmateriel;
  $res = recherche("sessions", "id_localisation", $id_localisation);
  if (fetch_object($res))
    $mes.=$localsertsession;
  if ($mes!="")
  {
    echo $mes;
		echo cadre_fin();
    break;
  }

  $query = "DELETE FROM localisations WHERE id='$id_localisation'";
  $result = executeRequete($query);
  echo "<p>$slocalsupprok</p>";

  $query = "DELETE FROM calendrier WHERE id_localisation='$id_localisation'";
  $result = executeRequete($query);
  $query = "DELETE FROM modeles_horaires WHERE id_localisation='$id_localisation'";
  $result = executeRequete($query);
  echo "<p>$slocalsuppravertissement</p>";
	echo cadre_fin();
  break;

case 2:   // Formulaire modification
	echo cadre_debut($slocalmaj);
  if (! verifiedroits("r"))
	{
		echo cadre_fin();
		break;
	}
	$result = recherche("localisations", "id", $id_localisation);
	if (! $u=fetch_array($result))
	{
		echo "<p>$localisationintrouvable</p>\n";
		echo cadre_fin();
		break;
	}
	$operation=21;
	$id_stru2=$id_structure; // sauvegarde de la structure qui visite
	extract($u);
	$id_stru=$id_structure;
	$id_structure=$id_stru2;	// restauration de la structuer qui visite.

case 1:  // Ajoute une nouvelle localisation (ou la modifie)
  if ($operation==1)
		echo cadre_debut($slocalnouveau);
	if ($operation!=21)
    $operation=11;

	if (LOCALISATIONS_MOI<"w" && LOCALISATIONS_AUTRES<"w")
	{
		echo $pasledroit;
		echo cadre_fin();
		break;
	}
  echo "<table align=center border=1>
          <form name=\"modilocal\" method=\"post\" action=\"localisations.php\">\n";
  if ($operation==21)
      echo "<input type=\"hidden\" name=\"id_localisation\" value=\"$id_localisation\">\n";
  echo "<input type=\"hidden\" name=\"operation\" value=\"$operation\">
        <tr><td>$sStructure* :</td><td>";
  // TODO changer les 7 lignes suivantes
  //if ($isadmin=="super")
	if (!$id_stru)
	  $id_stru=$id_structure;
	choix_structure($id_stru, "id_stru");
  /*else
  {
    echo structure($id_structure);
    echo "<input type=\"hidden\" name=\"id_stru\" value=\"$id_structure\">\n";
  } */
  echo "</td></tr>
        <tr><td>$sSalle :</td>
            <td><input type=\"text\" name=\"salle\" value=\"$salle\" size=\"50\" maxlength=\"100\"></td></tr>
        <tr><td>$sCommentaire :</td>
            <td><textarea name=\"description\" cols=\"40\" rows=\"5\">$description</textarea></td></tr>
        <tr><td>$slienimage 1 :</td>
            <td><input type=\"text\" name=\"image\" value=\"$image\" size=\"50\" maxlength=\"120\"></td></tr>
        <tr><td>$slienimage 2 :</td>
            <td><input type=\"text\" name=\"image2\" value=\"$image2\" size=\"50\" maxlength=\"120\"></td></tr>\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($slocalnouveau);
	if (LOCALISATIONS_MOI<"w" && LOCALISATIONS_AUTRES<"w")
	{
		echo $pasledroit;
		echo cadre_fin();
		break;
	}
	// vrification des paramtres
	$mes="";
	if ($salle=="") $mes.=$slocalmanquenom;
	if ($id_stru=="") $mes.=$smanquestructure;
	if ($mes!="")
	{
		echo "$mes\n";
		echo cadre_fin();
		break;
	}
	$query = "INSERT INTO localisations
											(id_structure, salle, description, image, image2)
							VALUES (\"$id_stru\", \"$salle\", \"$description\", \"$image\", \"$image2\")";
	if (executeRequete($query))
		echo "<p>$slocalnouveauok</p>";
		echo cadre_fin();
	break;

case 21:  // Modif finale
	echo cadre_debut($slocalmaj);
	// vrification des paramtres
	$mes="";
	if ($salle=="") $mes.=$slocalmanquenom;
	if ($id_stru=="") $mes.=$smanquestructure;
	if ($id_localisation=="") $mes.=$salleintrouvable;
	if ($mes!="")
	{
		echo "$mes\n";
		echo cadre_fin();
		break;
	}
	$query = "UPDATE localisations SET
									id_structure=\"$id_stru\", salle=\"$salle\", description=\"$description\",
									image=\"$image\", image2=\"$image2\"
							WHERE id=\"$id_localisation\"";
	if ($result = executeRequete($query))
		echo "<p>$slocalmajok</p>";
	echo cadre_fin();
	break;

case 5 : // liste des localisations

default : // liste des localisations
	echo cadre_debut($slistelocalisations);
  if (LOCALISATIONS<="~")
  {
    echo $pasledroit;
		echo cadre_fin();
    break;
  }
  $req = "SELECT * FROM localisations";
  if (LOCALISATIONS_AUTRES<"r")
    $req.=" WHERE id_structure=$id_structure";
  $req.=" ORDER BY id_structure, salle";
  $res = executeRequete($req);
  echo "<table align=center border=1>\n";
  while ($u=fetch_object($res))
  {
    $id_localisation=$u->id;
		if (verifiedroits("r"))
		{
    	echo "<tr><td>".localisation($u->id, TRUE)."</td>";
			if (verifiedroits("w", false))
				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" || LOCALISATIONS_AUTRES>="w")
    echo "<tr><td colspan=5 align=right><a href=\"localisations.php?operation=1\">$ajouter</a></td></tr>\n";
  echo "</table>\n";
	echo cadre_fin();
  break;
} // switch


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

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