Subversion Repositories Applications.papyrus

Rev

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

<?php
// +------------------------------------------------------------------------------------------------------+
// | 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_formulaireInscriptionProjet.class.php,v 1.2.8.1 2007-11-21 09:37:53 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireInscriptionProjet
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.2.8.1 $
// +------------------------------------------------------------------------------------------------------+
*/


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

require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';

/**
 * class HTML_formulaireInscriptionProjet
 * 
 */
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
{
     /*** Attributes: ***/

    /**
     * 
     *
     * @return void
     * @access public
     */
    function HTML_formulaireInscriptionProjet( $formName = '',  $method = 'post',  $action = '',  $target = '_self',  $attributes = '',  $trackSubmit = false )
    {
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
    } // end of member function HTML_formulaireInscriptionProjet

    /**
     * 
     *
     * @return void
     * @access public
     */
    function construitFormulaire(& $projet )
    {
         $squelette =& $this->defaultRenderer();
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
        
        $modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
                                        "\n".'{element}'."\n".''."\n".
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
                                        ''."\n" ;
        $modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
                                        "\n".'{element}'."\n".''."\n".
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
                                        '</li>'."\n" ;
        
        $squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
                                        "\n".'{element}'."\n".''."\n".
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
                                        '</li>'."\n");
        $squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
        $squelette->setElementTemplate( '{element}</li></ul>', 'valider');
    
        $squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
    
        if ($projet->avoirListe()) {
            $this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
            $this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
            
            // Indisponible pour le moment
            //$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
        }
        $this->addElement ('hidden', 'id_projet', $projet->getId()) ;
        $url_annuler = new Net_URL($this->getAttribute('action')) ;
        $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
        $url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER, 
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
                                                                                                            // qui remplacent deux fois les & par des &amp;
                                                                                                            // ce qui fait échouer le lien
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
        $this->addGroup($buttons, null, null, '&nbsp;');
        
    } // end of member function construitFormulaire


} // end of HTML_formulaireInscriptionProjet
?>