New file |
0,0 → 1,216 |
<?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: HTML_listeParticipants.class.php,v 1.5 2008-08-25 15:13:17 alexandre_tb Exp $ |
/** |
* Application projet |
* |
* La classe HTML_listeParticipants |
* |
*@package projet |
//Auteur original : |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.5 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ; |
|
|
/** |
* class HTML_listeParticipants |
* |
*/ |
class HTML_listeParticipants extends HTML_Liste |
{ |
/*** Attributes: ***/ |
|
/** |
* Le mode, par défaut 0 => normal 1 => modification En mode modification, une |
* colonne de plus pour désinscrire un utilisateur |
* @access private |
*/ |
var $_mode; |
/** |
* L'url vers la page affichant la liste |
* @access private |
*/ |
var $_url; |
|
/** |
* |
* |
* @return void |
* @access public |
*/ |
function HTML_listeParticipants( $utilise_pager) |
{ |
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ; |
} // end of member function HTML_listeParticipants |
|
/** |
* |
* |
* @param Array elements Tableau des éléments de l'entête. Des labels. |
* @return void |
* @access public |
*/ |
function construitEntete( $elements ) |
{ |
if ($this->_mode == 1) { |
array_push ($elements, PROJET_SUPPRIMER) ; |
} |
$this->addRow ($elements, '', 'TH') ; |
} // end of member function construitEntete |
|
/** |
* |
* |
* @param Array elements Tableau à deux dimension contenant les éléments à afficher. |
* @return void |
* @access public |
*/ |
function construitListe( $elements, $tableau_statut = '', &$projet ) |
{ |
for ($i = 0; $i < count ($elements) ; $i++) { |
// L'identifiant de l'utilisateur est le premier élément du tableau |
$id_utilisateur = array_shift ($elements[$i]) ; |
|
// L'identifiant du statut est le dernier |
if (count ($elements)>5) $inscrit_liste = (int) array_pop ($elements[$i]); |
$id_statut = (int) array_pop ($elements[$i]) ; |
// En mode modif on ajoute la colonne supprimer |
if ($this->_mode == 1) { |
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ; |
$this->_url->addQueryString('statut', 4) ; |
$supprimer = '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'.PROJET_SUPPRIMER.'</a>'; |
if (count ($elements) > 5) array_push ($elements[$i], ''); |
array_push ($elements[$i], '', $supprimer); |
$this->_url->removeQueryString('statut') ; |
} |
|
// La colonne avec l inscription a la liste de discussion |
|
$this->addRow ($elements[$i]) ; |
// mise à jour du champs mail en l'entourant par la balise mailto |
|
/// $i+1 pour sauter la ligne de titre, |
|
if (strlen ($elements[$i][2]) > 10) { |
$mail_racourci = substr($elements[$i][2], 0, 10).'...' ; |
} |
|
$this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ; |
|
// Mise à jour de la cellule contenant le statut |
if ($this->_mode == 1) { |
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ; |
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ; |
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ; |
foreach ($tableau_statut as $cle =>$element_statut) { |
$select .= '<option value="'.$cle.'"' ; |
if ($cle == $id_statut) { |
$select .= ' selected="selected"' ; |
} |
$select .= '>'.$element_statut.'</option>'."\n" ; |
} |
$select .= '</select>'."\n".'</form>'."\n" ; |
$this->setCellContents($i+1, 4, $select) ; |
|
// Colonne avec l inscription a la liste de discussion |
if (count ($elements)>5) { |
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ; |
|
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ; |
$select .= '<select name="inscription_liste" onchange="javascript:this.form.submit();">' ; |
$select .= '<option value="0">Non inscrit</option>'; |
$select .= '<option value="1"'.($inscrit_liste ? ' selected="selected"': '').'>Inscrit</option>'; |
$select .= '</select>'."\n".'</form>'."\n" ; |
$this->setCellContents($i+1, 5, $select) ; |
} |
} |
if ($id_statut == 1 && $this->_mode != 1) { |
$this->setCellContents($i + 1, 4, PROJET_CHEF) ; |
$this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ; |
} |
if ($this->_mode != 1 && $id_statut != 1) { |
$this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ; |
} |
$this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ; |
$this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ; |
} |
|
} // end of member function construitListe |
|
/** |
* |
* |
* @return void |
* @access public |
*/ |
function setModeModification( ) |
{ |
$this->_mode = 1 ; |
} // end of member function setModeModification |
|
/** |
* Renvoie le code HTML de la table. |
* |
* @return string |
* @access public |
*/ |
function toHTML( ) |
{ |
// Application de style |
$this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ; |
|
// s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants |
if ($this->getRowCount() == 1) { |
return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n"; |
} |
|
$res = HTML_Table::toHTML() ; |
|
return $res ; |
} // end of member function toHTML |
|
/** |
* Fixe la valeur de l'URL |
* |
* @param Net_URL url Un pointeur vers un objet Net_URL |
* @return void |
* @access public |
*/ |
function setURL( &$url ) |
{ |
$this->_url = $url ; |
} // end of member function setURL |
|
} // end of HTML_listeParticipants |
?> |