<?php
/*
Copyright (C) 2001, 2002 Bertand Pallie, Loc Dayot - Mairie Pierrefitte (93)
EPNadmin - Version 0.6 - 13/05/2003
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
//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
// -
// Structures, lieux, salles -
// -
function structure($id_structure)
{
$res=recherche("structures", "id", $id_structure);
$stru=fetch_object($res);
return "$stru->structure $stru->ville";
}
function localisation($id_localisation, $image=FALSE, $liens=FALSE)
{
global $id_structure, $sequipement;
$res=recherche("localisations", "id", $id_localisation);
$local=fetch_object($res);
$retour="";
if ($image && $local->image!="")
$retour.="<img src=\"$local->image\" height=\"80\">";
if ($image && $local->image2!="")
$retour.="<img src=\"$local->image2\" height=\"80\">";
$retour.="$local->salle de ".structure($local->id_structure);
if ($liens && defined("FCT_PARC") && (
($id_structure==$reponse->id_structure && PARC_MOI>="r")
|| PARC_AUTRES>="r") )
$retour.=" - <font size=\"-1\"><a href=\"materiels.php?operation=5&lieuv=L$id_localisation\">$sequipement</a></font>";
if ($image && $local->description!="")
$retour.="<br><font size=\"-1\">$local->description</font>";
return $retour;
}
// Partie d'un formulaire proposant la liste droulante des structures
function choix_structure($id_stru, $champ="id_structure", $vide="n'importe lequel")
{
echo "<select name=\"$champ\"><option value=\"\">$vide</option>\n";
$req="SELECT * FROM structures ORDER BY ville, structure";
$res=executeRequete($req);
while ($structure=fetch_object($res))
{
echo "<option value=\"$structure->id\"";
if ($structure->id==$id_stru)
echo " selected";
echo ">".substr($structure->ville,0,10)." : ".substr($structure->structure,0,20)."\n";
}
echo "</select>\n";
}
// Partie de formulaire
function choix_lieu($structure, $champ="lieuv")
{
echo "<select name=\"$champ\">\n";
echo "<option value=\"*\">n'importe o</option>\n";
$req="SELECT *, localisations.id AS id_localisation FROM localisations
LEFT JOIN structures ON localisations.id_structure=structures.id
ORDER BY structures.ville, structures.structure";
$res = executeRequete($req);
$ville_prec=$struct_prec=$local_prec="";
while ($lieux = fetch_object($res))
{
if ($ville_prec != $lieux->ville)
{
echo "<option value=\"V$lieux->ville\"";
if ($structure == "V".$lieux->ville) echo " selected";
echo ">$lieux->ville</option>";
}
$ville_prec=$lieux->ville;
if ($struct_prec != $lieux->id_structure)
{
echo "<option value=\"S$lieux->id_structure\"";
if ($structure == "S".$lieux->id_structure) echo " selected";
echo ">".substr($lieux->ville,0,10)." : ".substr($lieux->structure,0,30)."</option>\n";
}
$struct_prec=$lieux->id_structure;
if ($local_prec != $lieux->id_localisation)
{
echo "<option value=\"L$lieux->id_localisation\"";
if ($structure == "L".$lieux->id_localisation) echo " selected";
echo ">".substr($lieux->ville,0,10)." : ".substr($lieux->structure,0,10)
." : ".substr($lieux->salle,0,20)."</option>\n";
}
$local_prec=$lieux->id_localisation;
}
echo "</select>\n";
}
// TODO : quelle diffrence entre choix_lieu et Choixsalle ???
// Partie de formulaire
function ChoixSalle($id_localisation, $enable="", $droit=TRUE)
{
global $id_structure;
if ($enable=="disabled")
echo "<input type=\"hidden\" name=\"id_localisation\" value=\"$id_localisation\">";
else
{
echo "<td><select name=\"id_localisation\">\n";
echo "<option></option>\n";
$req="SELECT *, localisations.id AS id_localisation FROM localisations
LEFT JOIN structures ON localisations.id_structure=structures.id";
if (!$droit && $id_structure)
$req.=" WHERE id_structure=\"$id_structure\"";
$req.=" ORDER BY ville, structure, salle";
$res = executeRequete($req);
while ($lieux = fetch_object($res))
{
echo "<option value=\"$lieux->id_localisation\"";
if ($id_localisation == $lieux->id_localisation) echo " selected";
//echo ">$lieux->ville - $lieux->structure - $lieux->salle</option>\n";
echo ">".substr($lieux->ville,0,20)." : ".substr($lieux->structure,0,20)
." : ".substr($lieux->salle,0,20)."</option>\n";
}
echo "</select></td>\n";
}
}
?>