<?php
/*
Copyright (C) 2001, 2002 Bertand Pallie, Loc Dayot - Mairie 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
//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("animateurs.inc.php"); // concernant la gestion des animateurs
//require_once("reservations.inc.php"); // concernant les rservations des postes en accs individuel par des animateurs
//require_once("tableaux.inc.php"); // Concernant l'affichage transpos d'un tableau
//require_once("siteweb.inc.php"); // concernant les pages perso des animateurs 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 animateurs et leur positionnement
// -
// Structures, lieux, salles -
// -
function animateur($id_structure)
{
$res=recherche("animateurs", "id", $id_structure);
$stru=fetch_object($res);
return "$stru->nom $stru->prenom $stru->ville";
}
function affiche_liste_animateurs($id, $login, $nom, $prenom, $tri="nom", $mode="animateur")
{
$criteres = "";
$prem =" WHERE ";
if ($nom!="") { $criteres .= $prem."nom LIKE '$nom%'"; $prem=" AND "; }
if ($prenom!="") { $criteres .= $prem."prenom LIKE '$prenom%'"; $prem=" AND "; }
if ($id!="") { $criteres .= $prem."id='$id'"; $prem=" AND "; }
if ($login!="") { $criteres .= $prem."login LIKE '$login%'"; $prem=" AND "; }
$req = "SELECT * FROM animateurs ".$criteres." ORDER BY $tri LIMIT 30";
$res = executeRequete($req);
echo "<table border=1 align=center>
<tr><th>";
if ($mode=="RESERVATION")
echo "U1 U2";
echo "</th>
<th>No id<br>Code barre</th>
<th>Identifiant</th>
<th>Prénom</th>
<th>Nom</th>
<th>Autre</th>
</tr>\n";
switch ($mode)
{
case "RESERVATION" : $rop=3; break;
case "COURRIEL" : $rop=70; break;
default : $rop=5;
}
formRechercheanimateur($rop, "LIGNE", $mode);
while ($animateur = fetch_object($res))
{
if ($couleur=="lightgrey")
$couleur="";
else
$couleur="lightgrey";
affiche_animateur($animateur, "LISTE", $couleur, $mode);
}
echo "</table>\n";
}
// Partie d'un formulaire proposant la liste droulante des animateurs
function choix_animateur($id_animateur, $champ="id_animateur", $vide="n'importe lequel")
{
/*echo "<form action=\"$PHPSELF?operation=1\" method=\"post\" name=\"choixanim\">
<select name=\"id_animateur\" onchange=\"document.choixanim.submit();\">";*/
echo "<select name=\"$champ\"><option value=\"\">$vide</option>\n";
$req="select * from animateurs";
$res=executerequete($req);
while($listanim=$res->fetchrow(DB_FETCHMODE_OBJECT))
{
if($listanim->id==$id_animateur)
echo "<option selected value=\"$listanim->id\">$listanim->prenom,$listanim->nom</option>";
else
echo "<option value=\"$listanim->id\">" .substr($listanim->prenom,0,10) .substr($listanim->nom,0,20) ."</option>";
}
echo "</select>";
}
function affiche_animateur($animateur, $FORMAT="LISTE", $couleur="#FFFFFF", $mode="animateur")
{
global $tarifs, $couleurtarif, $id_session, $datev, $id_materiel, $id_horaire,
$usagev, $info, $modifier, $programmer, $supprimer;
switch ($FORMAT)
{
case "LISTE" :
echo "<tr bgcolor=\"$couleur\">
<td nowrap>";
switch ($mode)
{
case "animateur" :
if (ANIMATEURS_AUTRES>="r")
echo "<a href=\"animateur.php?id_animateur=$animateur->id\">$info</a> ";
if (ANIMATEURS_AUTRES>="w")
{
echo "<a href=\"animateur.php?id_animateur=$animateur->id&operation=1\">$modifier</a> ";
echo "<a href=\"animateur.php?id_animateur=$animateur->id&operation=2\">$supprimer</a> ";
}
break;
case "SESSION" :
echo "<a href=\"inscription_session.php?id_animateur=$animateur->id&operation=3&id_session=$id_session\">$programmer</a> ";
break;
case "COURRIEL" :
echo "<a href=\"courriel.php?id_animateur=$animateur->id&operation=71\">$programmer</a> ";
break;
case "RESERVATION" :
// Modification du 23 mars 2002
//echo "<a href=\"?id_animateur=$animateur->id&operation=31&id_materiel=$id_materiel&datev=$datev&id_horaire=$id_horaire&usagev=$usagev\">$programmer</a>";
echo "<a href=\"#a\" onclick=\"document.form2.id_animateur.value=$animateur->id;document.rechercheanimateur.id_animateur.value=$animateur->id;\">$programmer</a> \n";
echo "<a href=\"#a\" onclick=\"document.form2.id_animateur2.value=$animateur->id;document.rechercheanimateur.id_animateur2.value=$animateur->id;\">$programmer</a> \n";
case "PARCOURS" :
break;
}
echo "</td>
<td>$animateur->id</td>
<td><a href=\"animateur.php?id_animateur=$animateur->id\">$animateur->login</a>
</td>
<td>$animateur->prenom</td><td>$animateur->nom</td>";
/* <td bgcolor=\"".$couleurtarif[$animateur->id_tarif]."\"><font size=\"-1\">".$tarifs[$animateur->id_tarif]."</font></td>";
echo "<td nowrap>I : ";
if ($animateur->credit_acces_individuel!="00:00")
echo min2h($animateur->credit_acces_individuel);
if ($animateur->fin_abonnement_acces_individuel>"1")
echo "->".datetodatecourt($animateur->fin_abonnement_acces_individuel);
echo "<br>C : ";
if ($animateur->credit_activites_collectives!="00:00")
echo min2h($animateur->credit_activites_collectives);
if ($animateur->fin_abonnement_activites_collectives>"1")
echo "->".datetodatecourt($animateur->fin_abonnement_activites_collectives);
echo "</td><td";
if ($animateur->credit_reservable<=0)
echo " bgcolor=\"#FF1111\"";
echo ">";
if (isset($animateur->credit_reservable))
echo min2h($animateur->credit_reservable);
echo datetoheure($animateur->credit_reservable);
echo "</td>";*/
if ($mode=="PARCOURS")
{
echo "<td><a href=\"inscription_session.php?id_session=$animateur->id_session\">".datetodate($animateur->date_session)."</a></td>\n";
echo "<td>$animateur->etat</td>\n";
}
else
{
echo "<td><font size=\"-1\">";
if (!$animateur->naissance || $animateur->naissance<="0000-00-00")
echo "<font color=\"#FF0000\"><b>Date naissance inconnue !</b></font>";
if ($animateur->commentaires || $animateur->commentaire)
echo "$animateur->commentaire<br>
$animateur->commentaires";
echo "</font></td></tr>\n";
}
break;
case "SESSION" :
break;
case "COMPLET" :
echo "<table border=1 align=center>
<tr><td>Prénom :</td><td><b>$animateur->prenom</b></td></tr>
<tr><td>Nom :</td><td><b>$animateur->nom</b></td></tr>
<tr><td>Identifiant :</td><td>$animateur->login</td></tr>\n";
/* if ($isadmin)
echo "<tr><td>Mot de passe :</td><td>$animateur->motdepasse</td></tr>\n"; */
echo "<tr><td>Date de naissance :</td>";
if (!$animateur->naissance)
echo "<td bgcolor=\"black\"><font color=\"#FF0000\"><b>Inconnue !</b></font>";
else
echo "<td>".datetodate($animateur->naissance);
echo "</td></tr>
<tr><td>Adresse :</td><td>$animateur->adresse</td></tr>";
echo "<tr><td>Courriel :</td><td>$animateur->courriel</td></tr>
<tr><td>Structure de provenance :</td>";
if ($animateur->id_structure)
if ($res = recherche("structures", "id", $animateur->id_structure))
{
$structure = $res->fetchrow(DB_FETCHMODE_OBJECT);
echo "<td>$structure->structure</td></tr>\n";
}
if (($is_ident=="structure" || $is_ident=="animateur") && (ANIMATEURS_AUTRES>="r"))
echo "<tr><td>Commentaires :</td><td>$animateur->commentaire</td></tr>";
echo "</table>\n";
break;
}
}
function formRechercheanimateur($operation_retour=0, $format="AUTONOME", $mode="")
{
global $usagev, $datev, $debutv, $finv, $id_horaire, $id_materiel, $id_session,
$id_animateur, $id_animateur2, $PHP_SELF;
echo "<form name=\"rechercheanimateur\" method=\"post\" action=\"$PHP_SELF\">
<input type=\"hidden\" name=\"operation\" value=\"$operation_retour\">";
if ($datev) echo "<input type=\"hidden\" name=\"datev\" value=\"$datev\">";
if ($debutv) echo "<input type=\"hidden\" name=\"debutv\" value=\"$debutv\">";
if ($id_horaire) echo "<input type=\"hidden\" name=\"id_horaire\" value=\"$id_horaire\">";
if ($id_materiel) echo "<input type=\"hidden\" name=\"id_materiel\" value=\"$id_materiel\">";
if ($id_session) echo "<input type=\"hidden\" name=\"id_session\" value=\"$id_session\">";
if ($format=="AUTONOME")
echo "<table bgcolor=\"#FFF0F0\" align=center border=1>
<tr><td></td><td>No id<br>Code-barre</td><td>Identifiant</td><td>Prénom</td><td>Nom</td></tr>\n";
echo "<tr>
<td></td>
<td><input type=\"text\" name=\"id\" value=\"$id\" size=10><br><input type=\"text\" name=\"code_barre\" value=\"$code_barre\" size=10></td>
<td><input type=\"text\" name=\"login\" value=\"$login\" size=10></td>
<td><input type=\"text\" name=\"prenom\" value=\"$prenom\" size=10></td>
<td><input type=\"text\" name=\"nom\" value=\"$nom\" size=10></td>
<td colspan=3><input type=\"submit\" name=\"Rechercher\" value=\"Rechercher\"></td><td>";
if ($mode=="RESERVATION")
{
echo "<input type=\"text\" name=\"usagev\" value=\"$usagev\" size=\"3\">";
echo "<input type=\"text\" name=\"finv\" value=\"$finv\" size=\"6\">";
echo "<input type=\"text\" name=\"id_animateur\" value=\"$id_animateur\" size=\"4\">";
echo "<input type=\"text\" name=\"id_animateur2\" value=\"$id_animateur2\" size=\"4\">";
}
elseif ($usagev) echo "<input type=\"hidden\" name=\"usagev\" value=\"$usagev\">";
echo"</td></tr>";
if ($format=="AUTONOME") echo "</table>\n";
echo "</form>\n";
}
?>