Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/actions/participants.php
New file
0,0 → 1,126
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library 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.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participants.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
 
 
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
$res = '' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise à jour de statut
if (isset($_REQUEST['statut'])) {
$participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
 
// Ce qui suit doit être amélioré pour sortir la requête sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
// Le statut 2 est le statut participant
$participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if ($statut == 4) $droits = PROJET_DROIT_AUCUN ;
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
$HTML_listeParticipants = new HTML_listeParticipants(true) ;
if ($droits <= PROJET_DROIT_COORDINATEUR) $HTML_listeParticipants->setModeModification() ;
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$HTML_listeParticipants->setURL($this->_url) ;
// Construction de l'entete
$entete = array (PROJET_NOM, PROJET_PRENOM) ;
 
array_push ($entete, PROJET_MAIL) ;
 
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
array_push ($entete, PROJET_DATE_INSCRIPTION, PROJET_STATUT) ;
$HTML_listeParticipants->construitEntete($entete) ;
$HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db)) ;
$res = $HTML_listeParticipants->toHTML() ;
if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
$res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form>'."\n" ;
}
} else {
$res .= '<p>'.PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE.'</p>'."\n" ;
}
$retour .= $titre.$res ;
 
 
?>