| 431 | 
           mathias | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /*vim: set expandtab tabstop=4 shiftwidth=4: */
  | 
        
        
            | 
            | 
           3 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           4 | 
           // | PHP version 4.1                                                                                      |
  | 
        
        
            | 
            | 
           5 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           6 | 
           // | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
  | 
        
        
            | 
            | 
           7 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           8 | 
           // | This library is free software; you can redistribute it and/or                                        |
  | 
        
        
            | 
            | 
           9 | 
           // | modify it under the terms of the GNU General Public                                                  |
  | 
        
        
            | 
            | 
           10 | 
           // | License as published by the Free Software Foundation; either                                         |
  | 
        
        
            | 
            | 
           11 | 
           // | version 2.1 of the License, or (at your option) any later version.                                   |
  | 
        
        
            | 
            | 
           12 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           13 | 
           // | This library is distributed in the hope that it will be useful,                                      |
  | 
        
        
            | 
            | 
           14 | 
           // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
  | 
        
        
            | 
            | 
           15 | 
           // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
  | 
        
        
            | 
            | 
           16 | 
           // | General Public License for more details.                                                             |
  | 
        
        
            | 
            | 
           17 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           18 | 
           // | You should have received a copy of the GNU General Public                                            |
  | 
        
        
            | 
            | 
           19 | 
           // | License along with this library; if not, write to the Free Software                                  |
  | 
        
        
            | 
            | 
           20 | 
           // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
  | 
        
        
            | 
            | 
           21 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           22 | 
           // CVS : $Id: HTML_formulaireProjet.class.php,v 1.7 2007-11-21 09:42:50 alexandre_tb Exp $
  | 
        
        
            | 
            | 
           23 | 
           /**
  | 
        
        
            | 
            | 
           24 | 
           * Application projet
  | 
        
        
            | 
            | 
           25 | 
           *
  | 
        
        
            | 
            | 
           26 | 
           * La classe HTML_formulaireProjet
  | 
        
        
            | 
            | 
           27 | 
           *
  | 
        
        
            | 
            | 
           28 | 
           *@package projet
  | 
        
        
            | 
            | 
           29 | 
           //Auteur original :
  | 
        
        
            | 
            | 
           30 | 
           *@author        Alexandre Granier <alexandre@tela-botanica.org>
  | 
        
        
            | 
            | 
           31 | 
           //Autres auteurs :
  | 
        
        
            | 
            | 
           32 | 
           *@author        Aucun
  | 
        
        
            | 
            | 
           33 | 
           *@copyright     Tela-Botanica 2000-2004
  | 
        
        
            | 
            | 
           34 | 
           *@version       $Revision: 1.7 $
  | 
        
        
            | 
            | 
           35 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           36 | 
           */
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           39 | 
           // |                                            ENTETE du PROGRAMME                                       |
  | 
        
        
            | 
            | 
           40 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           /** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
           require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
  | 
        
        
            | 
            | 
           45 | 
           require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
  | 
        
        
            | 
            | 
           46 | 
           require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
           /**
  | 
        
        
            | 
            | 
           49 | 
            * class HTML_formulaireProjet
  | 
        
        
            | 
            | 
           50 | 
            * Cette classe représente un formulaire pour saisir un projet ou le modifier.
  | 
        
        
            | 
            | 
           51 | 
            */
  | 
        
        
            | 
            | 
           52 | 
           class HTML_formulaireProjet extends HTML_QuickForm
  | 
        
        
            | 
            | 
           53 | 
           {
  | 
        
        
            | 
            | 
           54 | 
              | 
        
        
            | 
            | 
           55 | 
               /**
  | 
        
        
            | 
            | 
           56 | 
                * Constructeur
  | 
        
        
            | 
            | 
           57 | 
                *
  | 
        
        
            | 
            | 
           58 | 
                * @param string formName Le nom du formulaire.
  | 
        
        
            | 
            | 
           59 | 
                * @param string method Soit get soit post, voir le protocole HTTP
  | 
        
        
            | 
            | 
           60 | 
                * @param string action L'action du formulaire.
  | 
        
        
            | 
            | 
           61 | 
                * @param string target La cible du formulaire.
  | 
        
        
            | 
            | 
           62 | 
                * @param Array attributes Des attributs supplémentaires pour la balise <form>
  | 
        
        
            | 
            | 
           63 | 
                * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
  | 
        
        
            | 
            | 
           64 | 
                * @return void
  | 
        
        
            | 
            | 
           65 | 
                * @access public
  | 
        
        
            | 
            | 
           66 | 
                */
  | 
        
        
            | 
            | 
           67 | 
               function HTML_formulaireProjet( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
  | 
        
        
            | 
            | 
           68 | 
               {
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
            | 
            | 
           70 | 
                   HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
  | 
        
        
            | 
            | 
           71 | 
               } // end of member function HTML_formulaireProjet
  | 
        
        
            | 
            | 
           72 | 
              | 
        
        
            | 
            | 
           73 | 
               /**
  | 
        
        
            | 
            | 
           74 | 
                * Renvoie le code HTML du formulaire.
  | 
        
        
            | 
            | 
           75 | 
                *
  | 
        
        
            | 
            | 
           76 | 
                * @return string
  | 
        
        
            | 
            | 
           77 | 
                * @access public
  | 
        
        
            | 
            | 
           78 | 
                */
  | 
        
        
            | 
            | 
           79 | 
               function toHTML( )
  | 
        
        
            | 
            | 
           80 | 
               {
  | 
        
        
            | 
            | 
           81 | 
                   $res = HTML_QuickForm::toHTML() ;
  | 
        
        
            | 
            | 
           82 | 
                   return $res ;
  | 
        
        
            | 
            | 
           83 | 
               } // end of member function toHTML
  | 
        
        
            | 
            | 
           84 | 
              | 
        
        
            | 
            | 
           85 | 
              | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
               /**
  | 
        
        
            | 
            | 
           88 | 
                * Ajoute les champs nécessaire au formulaire.
  | 
        
        
            | 
            | 
           89 | 
                *
  | 
        
        
            | 
            | 
           90 | 
                * @return void
  | 
        
        
            | 
            | 
           91 | 
                * @access public
  | 
        
        
            | 
            | 
           92 | 
                */
  | 
        
        
            | 
            | 
           93 | 
               function construitFormulaire(&$tableau_projet, $tableau_type = '', $tableau_theme = '')
  | 
        
        
            | 
            | 
           94 | 
               {
  | 
        
        
            | 
            | 
           95 | 
                   $this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255, 'size' => '80')) ;
  | 
        
        
            | 
            | 
           96 | 
                   $this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ;
  | 
        
        
            | 
            | 
           97 | 
                   if ($tableau_type != '') {
  | 
        
        
            | 
            | 
           98 | 
                       $select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ;
  | 
        
        
            | 
            | 
           99 | 
                       $this->addElement($select) ;
  | 
        
        
            | 
            | 
           100 | 
                       unset ($select) ;
  | 
        
        
            | 
            | 
           101 | 
                   }
  | 
        
        
            | 
            | 
           102 | 
                /*	impossible de faire fonctionner dojo Editor !!!
  | 
        
        
            | 
            | 
           103 | 
                 *
  | 
        
        
            | 
            | 
           104 | 
                   GEN_stockerStyleExterne('tundra', 'api/js/dojo1.0/dijit/themes/tundra/tundra.css');
  | 
        
        
            | 
            | 
           105 | 
                   GEN_stockerStyleExterne('dojo', 'api/js/dojo1.0/dojo/resources/dojo.css');
  | 
        
        
            | 
            | 
           106 | 
              | 
        
        
            | 
            | 
           107 | 
                  GEN_AttributsBody('class', 'tundra');
  | 
        
        
            | 
            | 
           108 | 
              | 
        
        
            | 
            | 
           109 | 
              | 
        
        
            | 
            | 
           110 | 
              | 
        
        
            | 
            | 
           111 | 
                   GEN_stockerFichierScript('dojo', 'api/js/dojo1.0/dojo/dojo.js',
  | 
        
        
            | 
            | 
           112 | 
           									'text/javascript',
  | 
        
        
            | 
            | 
           113 | 
           									array ('djConfig' => 'parseOnLoad: true, isDebug: true'));
  | 
        
        
            | 
            | 
           114 | 
           		 GEN_stockerFichierScript('dojo.editor', 'api/js/dojo1.0/dijit/Editor.js', 'text/javascript');
  | 
        
        
            | 
            | 
           115 | 
           		GEN_stockerCodeScript('dojo.config.allowXdRichTextSave = true;');
  | 
        
        
            | 
            | 
           116 | 
           		*/
  | 
        
        
            | 
            | 
           117 | 
                   $this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"5", 'cols'=>'80',
  | 
        
        
            | 
            | 
           118 | 
                   									 'width'=>"200", /*'dojoType' => 'dijit.Editor',*/ 'id' => 'resume_editeur')) ;
  | 
        
        
            | 
            | 
           119 | 
              | 
        
        
            | 
            | 
           120 | 
                   $this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION,
  | 
        
        
            | 
            | 
           121 | 
                   						array('class'=>"projet_resume", 'rows'=>"20", 'cols'=>'80'/*, 'dojoType' => 'dijit.Editor'*/)) ;
  | 
        
        
            | 
            | 
           122 | 
              | 
        
        
            | 
            | 
           123 | 
                   $this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet', 'size' => '80')) ;
  | 
        
        
            | 
            | 
           124 | 
              | 
        
        
            | 
            | 
           125 | 
                   // on fait un groupe avec les boutons radio pour les mettres sur la même ligne
  | 
        
        
            | 
            | 
           126 | 
              | 
        
        
            | 
            | 
           127 | 
                   $radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ;
  | 
        
        
            | 
            | 
           128 | 
                   $radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1');
  | 
        
        
            | 
            | 
           129 | 
                   $this->addGroup($radio, null, PROJET_INSCRIPTION, ' ');
  | 
        
        
            | 
            | 
           130 | 
              | 
        
        
            | 
            | 
           131 | 
              | 
        
        
            | 
            | 
           132 | 
                   /** Theme du projet ajout 05/2008 */
  | 
        
        
            | 
            | 
           133 | 
                   //var_dump ($tableau_theme);
  | 
        
        
            | 
            | 
           134 | 
                   if ($tableau_theme != '') {
  | 
        
        
            | 
            | 
           135 | 
              | 
        
        
            | 
            | 
           136 | 
                   	foreach ($tableau_theme as $cle => $theme) {
  | 
        
        
            | 
            | 
           137 | 
                   		$checkbox[$cle] = new HTML_QuickForm_checkbox('projet_theme['.$cle.']', '', $theme);
  | 
        
        
            | 
            | 
           138 | 
                   		$this->addElement($checkbox[$cle]);
  | 
        
        
            | 
            | 
           139 | 
                   	}
  | 
        
        
            | 
            | 
           140 | 
                   }
  | 
        
        
            | 
            | 
           141 | 
              | 
        
        
            | 
            | 
           142 | 
                   $label_projet = array() ;
  | 
        
        
            | 
            | 
           143 | 
                   $id_projet = array() ;
  | 
        
        
            | 
            | 
           144 | 
                   foreach ($tableau_projet as $projet) {
  | 
        
        
            | 
            | 
           145 | 
                       $label_projet[] = $projet->getTitre() ;
  | 
        
        
            | 
            | 
           146 | 
                       $id_projet[] = $projet->getId() ;
  | 
        
        
            | 
            | 
           147 | 
                   }
  | 
        
        
            | 
            | 
           148 | 
                   if (PROJET_UTILISE_HIERARCHIE) {
  | 
        
        
            | 
            | 
           149 | 
           	        $select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ;
  | 
        
        
            | 
            | 
           150 | 
           	        $this->addElement($select) ;
  | 
        
        
            | 
            | 
           151 | 
           	        unset ($select) ;
  | 
        
        
            | 
            | 
           152 | 
                   }
  | 
        
        
            | 
            | 
           153 | 
                   $this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ;
  | 
        
        
            | 
            | 
           154 | 
              | 
        
        
            | 
            | 
           155 | 
              | 
        
        
            | 
            | 
           156 | 
                   $this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
  | 
        
        
            | 
            | 
           157 | 
                   $url_annuler = new Net_URL($this->getAttribute('action')) ;
  | 
        
        
            | 
            | 
           158 | 
                   $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
  | 
        
        
            | 
            | 
           159 | 
              | 
        
        
            | 
            | 
           160 | 
                   // on fait un groupe avec les boutons pour les mettres sur la même ligne
  | 
        
        
            | 
            | 
           161 | 
                   $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
  | 
        
        
            | 
            | 
           162 | 
                                       preg_replace ("/&/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER);
  | 
        
        
            | 
            | 
           163 | 
                   $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
  | 
        
        
            | 
            | 
           164 | 
                   $this->addGroup($buttons, null, null, ' ');
  | 
        
        
            | 
            | 
           165 | 
              | 
        
        
            | 
            | 
           166 | 
               } // end of member function _construitFormulaire
  | 
        
        
            | 
            | 
           167 | 
           }
  | 
        
        
            | 
            | 
           168 | 
              | 
        
        
            | 
            | 
           169 | 
           /* +--Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           170 | 
           *
  | 
        
        
            | 
            | 
           171 | 
           * $Log$
  | 
        
        
            | 
            | 
           172 | 
           *
  | 
        
        
            | 
            | 
           173 | 
           * +-- Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           174 | 
           */
  | 
        
        
            | 
            | 
           175 | 
           ?>
  |