A
download logiciels.php
Language: PHP
License: GPL
Copyright: (C) 2001, 2002 Loc Dayot
LOC: 357
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
429
430
431
432
<?php
/*
    Copyright (C) 2001, 2002 Loc Dayot

    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_PARC"))
{
  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

/* LD : 22/02/2003
   Un nouveau champ dans la table logiciels a t ajout.
	 En effet, certains logiciels en prt notamment ne sont pas affects
	  un matriel. Il faut donc savoir dans quelle structure le logiciel se
	 trouve. D'o l'introduction du champ id_structure dans la table.
*/

$ptitr=$slogiciels;
$titr = $stitrelogiciels;
$datemaj="23 fvrier 2003";
define("COULEUR", COULEUR_PARC);
require("entete.inc.php");

if (PARC<="~")
  echo $pasledroit;
else
  if (PARC_AUTRES>="r")
    echo "<a href=\"logiciels.php?operation=5\">$svoirlistelogiciels</a>
         - <a href=\"materiels.php?operation=5\">$svoirlistemateriels</a>\n";
  elseif (PARC_MOI>="r" && $isident="structure")
    echo "<a href=\"logiciels.php?operation=5\">$svoirmalistelogiciels</a> -
         <a href=\"materiels.php?operation=5\">$svoirmalistemateriels</a>\n";
echo "<hr>";

function verifiedroits($droit="r", $affiche=TRUE)
{
global $id_logiciel, $id_structure,
  $manqueinfologiciel, $logicielintrouvable, $pasledroit;
  if (!$id_logiciel)
  {
    if ($affiche)
      echo $manqueinfologiciel;
    return FALSE;
  }
  $req="SELECT id_structure FROM logiciels
          WHERE id=\"$id_logiciel\"";
  $res=executeRequete($req);
  if (! $logiciel=fetch_object($res))
  {
    if ($affiche)
      echo $logicielintrouvable;
    return FALSE;
  }
  if (!(PARC_AUTRES>=$droit || (PARC_MOI>=$droit && $logiciel->id_structure==$id_structure)))
  {
    if ($affiche)
      echo $pasledroit;
    return FALSE;
  }
  return TRUE;
}

switch ($operation)
{
case 11 : // confirmation d'ajout ou mise  jour
	echo cadre_debut($smajlogiciel, "align=center", COULEUR_PARC);
	 if ($id_logiciel)
   {
     if (! verifiedroits("w"))
		 {
			 echo cadre_fin(COULEUR_PARC);
       break;
			}
   }
   elseif (PARC_MOI<"w" && PARC_AUTRES<"w")
		{
			echo cadre_fin(COULEUR_PARC);
   		break;
		}

	 $mes="";
   if ($type=="") $mes.=$smanquetype."<br>";
   if ($id_stru=="") $mes.=$smanquestrupropri."<br>";
   if ($titre=="") $mes.=$smanquetitre."<br>";
   if ($pret_possible=="") $mes.=$smanquepret."<br>";
   if ($reservable=="") $mes.=$smanqueresa."<br>";
   if ($mes!="")
      echo "<p>$mes</p>";
   else
   {
      if (!$id_logiciel)
      {
         echo "<p>$senrnouvlogiciel</p>\n";
         $req = "INSERT INTO logiciels "
              . "(type, titre, licence, id_structure, info_achat, "
              . "          commentaire, pret_possible, reservable, image) "
              . "VALUES "
              . "(\"$type\", \"$titre\", \"$licence\", \"$id_stru\", \"$info_achat\",
                  \"$commentaire\", \"$pret_possible\", \"$reservable\", \"$image\")";
         $res = executeRequete($req);
         // on recherche l'id_materiel pour pouvoir faire le lien avec les logiciels
         $req = "SELECT MAX(id) as mx FROM logiciels";
         $res = executeRequete($req);
         $max = fetch_object($res);
         $id_logiciel = $max->mx;
      }
      else
      { // C'est une mise  jour de l'enregistrement.
         echo "<p>$smaj</p>\n";
         $req = "UPDATE logiciels SET type=\"$type\",
										titre=\"$titre\", licence=\"$licence\", id_structure=\"$id_stru\",
							  		info_achat=\"$info_achat\",
										commentaire=\"$commentaire\", pret_possible=\"$pret_possible\",
										reservable=\"$reservable\", image=\"$image\" ";
         $req .= " WHERE id = \"$id_logiciel\"";
         $res = executeRequete($req);

         // Suppression des liens entre matriel et logiciels
         $req = "DELETE FROM logi_mate WHERE id_logiciel=$id_logiciel";
         $res = executeRequete($req);
        }
     // Affectation des liens
     $i=0;
     while ($id_materiel[$i])
     {
        $req = "INSERT INTO logi_mate (id_logiciel, id_materiel) "
             . "VALUES ($id_logiciel, $id_materiel[$i])";
        $res = executeRequete($req);
        $i++;
     }
		 echo cadre_fin(COULEUR_PARC);
     break; // tout c'est bien pass
   }
	echo cadre_fin(COULEUR_PARC);
   // pas de break si jamais il y avait besoin d'une nouvelle saisie.

case 2 : // formulaire d'dition
	if (! verifiedroits("w"))
		break;

	$res = recherche("logiciels", "id", $id_logiciel);
	if ($logi = mysql_fetch_array($res))
	{
		$id_structure_logguee=$id_structure; // Sauvegarde de la structure qui est identifie
		extract($logi);
		$id_stru=$id_structure;
		$id_structure=$id_structure_logguee; // On la retrouve.
	}
	// pas de break, on enchane avec le formulaire d'dition

case 1 : // formulaire d'ajout
  // Dbut du fomulaire de saisie d'enregistrement de logiciels
	echo cadre_debut($smajlogiciel, "align=center", COULEUR_PARC);
	if (PARC_MOI<"w" && PARC_AUTRES<"w")
	{
		echo cadre_fin(COULEUR_PARC);
		break;
	}
   echo "<form action=\"$PHP_SELF\" method=\"post\">";
   echo "<input type=\"hidden\" name=\"operation\" value=\"11\">";
   if ($id_logiciel)
      echo "<input type=\"hidden\" name=\"id_logiciel\" value=\"$id_logiciel\">";
   echo "<table align=\"center\" border=1>
         <tr><td>$stype*</td><td><select name=\"type\" size=\"1\">
             <option></option>";
	for ($ntype=0; $slistetypelogiciels[$ntype]; $ntype++)
	{
		echo "   <option value=\"$slistetypelogiciels[$ntype]\"";
		if ($type==$slistetypelogiciels[$ntype]) echo " SELECTED";
		echo ">$slistetypelogiciels[$ntype]</option>\n";
	}
	echo " </select></td></tr>
				 <tr><td>$sstruproprio</td><td>";
	if (!$id_stru) $id_stru=$id_structure;
	choix_structure($id_stru, "id_stru", "");
	echo " </td></tr>
					<tr><td>$sTitre</td><td><input type=\"text\" name=\"titre\" value=\"$titre\" size=\"30\" maxlength=\"80\"></td></tr>
         <tr><td>$sLicence</td><td><input type=\"text\" name=\"licence\" value=\"$licence\" size=\"30\" maxlength=\"40\"></td></tr>
         <tr><td>$sCommentaire</td><td><textarea name=\"commentaire\" rows=\"4\" cols=\"30\">$commentaire</textarea></td></tr>

         <tr><td>$sliemateriel</td>
         <td><select name=\"id_materiel[]\" size=\"10\" multiple>";

   $req = "SELECT * FROM materiels
                    LEFT JOIN logi_mate ON materiels.id=logi_mate.id_materiel";
   if (PARC_AUTRES<"w")
     $req.="        LEFT JOIN localisations ON localisations.id=materiels.id_localisation
                    WHERE id_structure=\"$id_structure\"";
   $req.="           ORDER BY type,id_localisation,materiel";
   $res = executeRequete($req);
   $mat = fetch_object($res);
   $ancien_id_mat=$mat->id;
   while ($mat)
   {
      $l = "<option value=\"$mat->id\"";
      $l2 = ">$mat->type ($mat->localisation) : $mat->materiel ($mat->specificite) ".substr($mat->description, 0, 20)."\n";
      $l1 = "";
      while (($mat) & ($mat->id == $ancien_id_mat))
      {
         if ($mat->id_logiciel==$id_logiciel) $l1 = " SELECTED";
         $mat = fetch_object($res);
      }
      echo "$l$l1$l2\n";
      $ancien_id_mat=$mat->id;
   }
   echo "</select>\n";
   echo "
      </td></tr>
      <tr><td>$spretpossible*</td><td><select name=\"pret_possible\" size=\"1\">
           <option>
           <option value=\"oui\"";
   if ($pret_possible=="oui") echo " SELECTED";
   echo ">$soui
           <option value=\"non\"";
   if ($pret_possible=="non") echo " SELECTED";
   echo ">$snon
         </select></td></tr>\n
      <tr><td>$slogicielreservable*</td><td><select name=\"reservable\" size=\"1\">
           <option>
           <option value=\"oui\"";
   if ($reservable=="oui") echo " SELECTED";
   echo ">$soui
           <option value=\"non\"";
   if ($reservable=="non") echo " SELECTED";
   echo ">$snon
         </select></td></tr>\n
        <tr><td>$sinfoachat</td><td><textarea name=\"info_achat\">$info_achat</textarea></td></tr>
        <tr><td>$slienimage</td><td><input type=\"text\" name=\"image\" value=\"$image\" size=\"40\" maxlength=\"64\"></td></tr>
        <tr><td colspan=\"2\"><center><input type=\"submit\" name=\"send\" value=\"$envoyer\"></center></td></tr>
        </table>
        </form>\n";
   // Fin du formulaire de saisie.
	echo cadre_fin(COULEUR_PARC);
   break;

case 3 : // formulaire de suppression
   if (! verifiedroits("w"))
     break;
   $contenu="<p align=center>$sattentionsupprlogiciel</p>
	 						<p align=center>
							<form action=\"$PHP_SELF\" method=\"POST\" enctype=\"multipart/form-data\">
							<input type=\"hidden\" name=\"operation\" value=31>
							<input type=\"hidden\" name=\"id_logiciel\" value=\"$id_logiciel\">
							<input type=\"submit\" value=\"$sconfirmer\">
            </form></p>\n";
	echo cadre($ssupprlogiciel, $contenu, "align=center", COULEUR_PARC);
   break;

case 31 : // confirmation de suppression
	cadre_debut($ssupprlogiciel, "align=center", COULEUR_PARC);
	if (verifiedroits("w"))
	{
		echo "<p>$slogicielsupprime</p>\n";
		$req = "DELETE FROM logiciels WHERE id=$id_logiciel";
		$res = executeRequete($req);

		$req = "DELETE FROM logi_mate WHERE id_logiciel=$id_logiciel";
		$res = executeRequete($req);
	}
	cadre_fin(COULEUR_PARC);
	break;

case 5 :
   // Affichage de la liste des materiels
	echo cadre_debut($slistelogiciels, "align=center", COULEUR_PARC);
   if (PARC>"~")
   {
      $req = "SELECT * FROM logiciels WHERE (0=0) ";
			if (PARC_AUTRES<"r") // On limite la visibilit si on a pas tous les droits
			  $req.=" AND id_structure=$id_structure ";
			if ($type>"" && $type!="*")
				$req.=" AND type=\"$type\"";
			if ($stru>0 && $stru!="*")
			  $req.=" AND id_structure=$stru ";
			$req.=" ORDER BY type, id_structure, titre, licence";
      $res = executeRequete($req);

			// Ligne de titres
      echo "<table border=1 align=center>
            <tr><th>$stype</th><th>$sstruproprio<th>$sTitre (licence)</th><th>$sActions</th></tr>\n";

			// Ligne pour les critres de slection
			echo "<form action=\"$PHP_SELF\" method=\"POST\" enctype=\"multipart/form-data\">
						<input type=\"hidden\" name=\"operation\" value=\"$operation\">
						<tr><td>";
			echo " <select name=\"type\"><option value=\"*\">Tous</option>";
			$reqtype="SELECT type FROM logiciels GROUP BY type ORDER BY type";
			$restype=executeRequete($reqtype);
			while ($enrtype=fetch_object($restype))
			{
				echo "<option value=\"$enrtype->type\"";
				if ($enrtype->type==$type) echo " selected";
				echo ">$enrtype->type</option>\n";
			}
			echo "</select>\n";
			echo "</td><td>";
			choix_structure($stru, "stru");
			echo "</td><td></td><td><input type=\"submit\" value=\"$srechercher\">";
			echo "</td></tr>\n</form>\n";

      $type="";
      while ($log = fetch_object($res))
      {
        $id_logiciel=$log->id;
        if (verifiedroits("r", FALSE))
        {
          echo "<tr>\n";
          if ($type!=$log->type)
          {
              echo "<th>$log->type</th>\n";
              $type=$log->type;
          }
          else
            echo "<td></td>\n";
					echo "<td>".structure($log->id_structure)."</td>\n";
          echo "<td>$log->titre";
					if (verifiedroits("w", FALSE)) 
						echo " ($log->licence)";
          if ($log->commentaire!="") echo "<br><i>$log->commentaire</i>";
          echo "</td>
                <td nowrap><a href=\"$PHP_SELF?id_logiciel=$log->id\">$info</a>\n";
          if (verifiedroits("w", FALSE))
            echo "  <a href=\"$PHP_SELF?operation=2&id_logiciel=$log->id\">$modifier</a>
                    <a href=\"$PHP_SELF?operation=3&id_logiciel=$log->id\">$supprimer</a></td></tr>\n";
        }
      }
      if (PARC_MOI>="w" || PARC_AUTRES>="w")
        echo "<tr><td colspan='3'></td><td><a href=\"$PHP_SELF?operation=1\">$ajouter</a></td></tr>\n";
      echo "</table>\n";
   }
   else
      echo $pasledroit;
   echo cadre_fin(COULEUR_PARC);
   break;

default : // affichage dtails
	echo cadre_debut($sdetaillogiciel, "align=center", COULEUR_PARC);
   if (verifiedroits("r"))
   {
      // affichage d'un rsum du matriel et des lments attenants
      $req1 = "SELECT * FROM logiciels WHERE id=$id_logiciel ";// AND type='Unit centrale'";
      $res1 = executeRequete($req1);
      if ($logiciel=fetch_object($res1))
      {
         echo "<table align=center border=1>
               <tr><td colspan=2 align=center><h3>$logiciel->titre</h3>";
         if ($logiciel->licence!="" && verifiedroits("w", FALSE))
           echo "($logiciel->licence)";
				echo "<br>$sstruproprio : ".structure($logiciel->id_structure);
         echo "</td></tr>\n";
         echo "<tr><td colspan=2>".nl2br($logiciel->description)."</td>
				 		<td><a href=\"logiciels.php?id_logiciel=$logiciel->id\">$info</a>";
				$id_logiciel=$logiciel->id;
         if (verifiedroits("w", FALSE))
            echo " <a href=\"logiciels.php?operation=2&id_logiciel=$logiciel->id\">$modifier</a>
                   <a href=\"logiciels.php?operation=3&id_logiciel=$logiciel->id\">$supprimer</a>\n";
         echo "</td></tr>\n";
         // affichage des materiels attachs au logiciel
         echo "<tr><td colspan=2 align=center><b>Liste des materiels attachs  ce logiciel</b></td></tr>\n";
         $req3 = "SELECT * FROM materiels LEFT JOIN logi_mate ON materiels.id=logi_mate.id_materiel
                          WHERE id_logiciel=$id_logiciel ORDER BY type, id_localisation, materiel";
         $res3 = executeRequete($req3);
         while ($materiel=fetch_object($res3)) // il y a des logiciels attachs au matriel $id_materiel
         {
            echo "<tr><td>$materiel->type</td><td>".localisation($materiel->id_localisation);
            if ($materiel->materiel>"")
              echo "<br><b>$materiel->materiel</b>";
            if ($materiel->description!="")
              echo "<br><i>".nl2br($materiel->description)."</i>";
            echo "</td>";
            //if ()
              echo "<td><a href=\"materiels.php?id_materiel=$materiel->id\">$info</a>\n";
            echo "</tr>\n";
         }
         echo "</table>\n";
      }
   }
   else
      echo $pasledroit;
	echo cadre_fin(COULEUR_PARC);
   break;

} // switch

if ($operation || $id_logiciel)
{
  echo "<hr>\n";
	if (PARC_AUTRES>="r")
		echo "<a href=\"logiciels.php?operation=5\">$svoirlistelogiciels</a>
				- <a href=\"materiels.php?operation=5\">$svoirlistemateriels</a>\n";
	elseif (PARC_MOI>="r")
		echo "<a href=\"logiciels.php?operation=5\">$svoirmalistelogiciels</a> -
				- <a href=\"materiels.php?operation=5\">$svoirmalistemateriels</a>\n";
}

require("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