Subversion Repositories Applications.projet

Rev

Rev 11 | Rev 37 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?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_listeProjet.class.php,v 1.4 2005-09-28 16:29:39 ddelon Exp $
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/


// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;

/**
 * class HTML_listeProjet
 * 
 */
class HTML_listeProjet extends HTML_Liste
{
    /*** Attributes: ***/
    /**
     * 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
     * d'un utilisateur.
     * @access private
     */
    var $_mode;
    /**
     * Un objet PEAR::Net_URL
     * @access private
     */
    var $_url;

    /**
     * 
     *
     * @param bool utilise_pager Indique si les résultats sont divisés en page.
     * @return void
     * @access public
     */
    function HTML_listeProjet( $utilise_pager = false )
    {
        HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre')) ;
    } // end of member function HTML_listeProjet

    /**
     * 
     *
     * @return void
     * @access public
     */
    function __construct($utilise_pager = false)
    {
        $this->HTML_listeProjet($utilise_pager);
        
    } // end of member function __cosntruct

    /**
     * 
     *
     * @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
     * @return void
     * @access public
     */
    function construitEntete( $label_entete )
    {
        $this->addRow ($label_entete, '', 'TH') ;
    } // end of member function construitEntete

    /**
     * 
     *
     * @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type 
     *      0 =>'label', 'label2', 
     *      1 => ...
     * @return void
     * @access public
     */
    function construitListe( $label_liste, $tableau_statut = '' )
    {
        for ($i = 0; $i < count ($label_liste) ; $i++) {
            if ($this->_mode == 1) {
                $id_projet = array_shift ($label_liste[$i]) ;
                $id_statut = array_pop ($label_liste[$i]) ;
            }
            
            $this->addRow ($label_liste[$i]) ;
            
            if ($this->_mode == 1 && $id_statut < 3) {
                $this->_url->addQueryString ('identifiant_projet', $id_projet) ;
                $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
                $select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\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" ;
                if (is_int($id_statut)) {
                    $this->setCellContents($i+1, 2, $select) ;
                } else {
                    $this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
                }
            }
        }
        $this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
        
    } // end of member function construitListe

    /**
     * 
     *
     * @return void
     * @access public
     */
    function setModeModification( )
    {
        $this->_mode = 1 ;
    } // end of member function setModeModification

    /**
     * 
     *
     * @param Net_URL url Un objet PEAR::Net_URL
     * @return void
     * @access public
     */
    function setURL(& $url )
    {
        $this->_url = $url ;
    } // end of member function setURL

} // end of HTML_listeProjet
?>