New file |
0,0 → 1,175 |
<?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_formulaireProjet.class.php,v 1.7 2007-11-21 09:42:50 alexandre_tb Exp $ |
/** |
* Application projet |
* |
* La classe HTML_formulaireProjet |
* |
*@package projet |
//Auteur original : |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.7 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */ |
|
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ; |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ; |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ; |
|
/** |
* class HTML_formulaireProjet |
* Cette classe représente un formulaire pour saisir un projet ou le modifier. |
*/ |
class HTML_formulaireProjet extends HTML_QuickForm |
{ |
|
/** |
* Constructeur |
* |
* @param string formName Le nom du formulaire. |
* @param string method Soit get soit post, voir le protocole HTTP |
* @param string action L'action du formulaire. |
* @param string target La cible du formulaire. |
* @param Array attributes Des attributs supplémentaires pour la balise <form> |
* @param bool trackSubmit Pour repérer si la formulaire a été soumis. |
* @return void |
* @access public |
*/ |
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false ) |
{ |
|
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ; |
} // end of member function HTML_formulaireProjet |
|
/** |
* Renvoie le code HTML du formulaire. |
* |
* @return string |
* @access public |
*/ |
function toHTML( ) |
{ |
$res = HTML_QuickForm::toHTML() ; |
return $res ; |
} // end of member function toHTML |
|
|
|
/** |
* Ajoute les champs nécessaire au formulaire. |
* |
* @return void |
* @access public |
*/ |
function construitFormulaire(&$tableau_projet, $tableau_type = '', $tableau_theme = '') |
{ |
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255, 'size' => '80')) ; |
$this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ; |
if ($tableau_type != '') { |
$select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ; |
$this->addElement($select) ; |
unset ($select) ; |
} |
/* impossible de faire fonctionner dojo Editor !!! |
* |
GEN_stockerStyleExterne('tundra', 'api/js/dojo1.0/dijit/themes/tundra/tundra.css'); |
GEN_stockerStyleExterne('dojo', 'api/js/dojo1.0/dojo/resources/dojo.css'); |
|
GEN_AttributsBody('class', 'tundra'); |
|
|
|
GEN_stockerFichierScript('dojo', 'api/js/dojo1.0/dojo/dojo.js', |
'text/javascript', |
array ('djConfig' => 'parseOnLoad: true, isDebug: true')); |
GEN_stockerFichierScript('dojo.editor', 'api/js/dojo1.0/dijit/Editor.js', 'text/javascript'); |
GEN_stockerCodeScript('dojo.config.allowXdRichTextSave = true;'); |
*/ |
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"5", 'cols'=>'80', |
'width'=>"200", /*'dojoType' => 'dijit.Editor',*/ 'id' => 'resume_editeur')) ; |
|
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION, |
array('class'=>"projet_resume", 'rows'=>"20", 'cols'=>'80'/*, 'dojoType' => 'dijit.Editor'*/)) ; |
|
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet', 'size' => '80')) ; |
|
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne |
|
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ; |
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1'); |
$this->addGroup($radio, null, PROJET_INSCRIPTION, ' '); |
|
|
/** Theme du projet ajout 05/2008 */ |
//var_dump ($tableau_theme); |
if ($tableau_theme != '') { |
|
foreach ($tableau_theme as $cle => $theme) { |
$checkbox[$cle] = new HTML_QuickForm_checkbox('projet_theme['.$cle.']', '', $theme); |
$this->addElement($checkbox[$cle]); |
} |
} |
|
$label_projet = array() ; |
$id_projet = array() ; |
foreach ($tableau_projet as $projet) { |
$label_projet[] = $projet->getTitre() ; |
$id_projet[] = $projet->getId() ; |
} |
if (PROJET_UTILISE_HIERARCHIE) { |
$select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ; |
$this->addElement($select) ; |
unset ($select) ; |
} |
$this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ; |
|
|
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ; |
$url_annuler = new Net_URL($this->getAttribute('action')) ; |
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ; |
|
// 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 ("/&/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER); |
$this->addGroup($buttons, null, null, ' '); |
|
} // end of member function _construitFormulaire |
} |
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log$ |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |