19,7 → 19,7 |
// | 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: selecteur_sites.php,v 1.3 2004-07-06 17:07:16 jpm Exp $ |
// CVS : $Id: selecteur_sites.php,v 1.4 2004-09-15 09:32:01 jpm Exp $ |
/** |
* Applette : selecteur sites |
* |
30,6 → 30,8 |
* - Pear Net_URL |
* - Pear DB |
* - API Débogage 1.0 |
* Le nom de l'applette est "SELECTEUR_SITES" pour afficher un formulaire HTML et "SELECTEUR_SITES_XHTML" |
* pour afficher un formulaire XHTML strict. |
* |
*@package Applette |
*@subpackage Selecteur_sites |
38,7 → 40,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.3 $ $Date: 2004-07-06 17:07:16 $ |
*@version $Revision: 1.4 $ $Date: 2004-09-15 09:32:01 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
46,7 → 48,7 |
// | ENTÊTE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
$_GEN_commun['info_applette_nom_fonction'] = 'afficherSelecteurSite'; |
$_GEN_commun['info_applette_balise'] = 'SELECTEUR_SITES'; |
$_GEN_commun['info_applette_balise'] = 'SELECTEUR_SITES_?(XHTML)?'; |
|
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
67,7 → 69,7 |
* @param array tableau global de Papyrus. |
* @return string formulaire XHTML contenant les sites disponibles. |
*/ |
function afficherSelecteurSite($tab_arguments, $_GEN_commun) |
function afficherSelecteurSite($tab_applette_arguments, $_GEN_commun) |
{ |
// Initialisation de variable de configuration. |
$objet_pear_db = $_GEN_commun['pear_db'];//objet Pear créé par DB contenant la connexion à la base de données. |
78,6 → 80,13 |
$url_id_type_site = GEN_URL_ID_TYPE_SITE; |
$indent_origine = 12;// Indentation de départ en nombre d'espace |
$indent_pas = 4;// Pas d'indentation en nombre d'espace |
|
// Récupérations des arguments passés dans la balise. |
// Nous vérifions si on veut du XHTML strict ou pas |
$bln_xhtml_strict = 0; |
if (isset($tab_applette_arguments[2]) && $tab_applette_arguments[2] == 'XHTML') { |
$bln_xhtml_strict = 1; |
} |
|
// Texte à traduire |
$etiquette_legende = 'Sélecteur de monde'; |
93,10 → 102,10 |
'AND gsr_id_valeur = 102 '.// 102 = site "principal" |
'AND gs_id_site = gsr_id_site_01'; |
|
$resultat = $objet_pear_db->query($requete); |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : ''; |
if ( $resultat->numRows() == 0 ) { |
$res = str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
$retourultat = $objet_pear_db->query($requete); |
(DB::isError($retourultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $retourultat->getMessage(), $requete)) : ''; |
if ( $retourultat->numRows() == 0 ) { |
$retour = str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
'<!-- '.$etiquette_erreur.' -->'; |
} else { |
// Préparation de l'url de retour du formulaire |
106,17 → 115,23 |
$champs_code_site = ($url_id_type_site == 'int') ? 'gs_code_num' : 'gs_code_alpha'; |
|
// Préparation du formulaire |
$res = str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
'<form id="selecteur_sites" name="selecteur_sites" action="'.$objet_pear_url->getURL().'" method="get">'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 1)). |
$retour = str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
'<form id="selecteur_sites" '; |
// Test sur XHTML strict |
if ($bln_xhtml_strict == 0) { |
$retour .= 'name="selecteur_sites" '; |
} |
$retour .= 'action="'.$objet_pear_url->getURL().'" method="get">'."\n"; |
|
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 1)). |
'<fieldset>'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
'<legend>'.$etiquette_legende.'</legend>'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
'<legend>'.$etiquette_legende.'</legend>'."\n"; |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
'<select id="'.$url_cle_site.'" name="'.$url_cle_site.'" onchange="javascript:this.form.submit();">'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 3)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 3)). |
'<option value="'.$code_site.'" selected="selected">'.$etiquette_option_defaut.'</option>'."\n"; |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($ligne = $retourultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
// Initialisation des variables |
$nom = ''; |
|
128,32 → 143,32 |
'AND gsr_id_site_02 = gs_id_site '. |
'AND gs_ce_i18n = "'.$id_langue.'"'; |
|
$resultat_traduction = $objet_pear_db->query($requete_traduction); |
(DB::isError($resultat_traduction)) |
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_traduction->getMessage(), $requete_traduction)) |
$retourultat_traduction = $objet_pear_db->query($requete_traduction); |
(DB::isError($retourultat_traduction)) |
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $retourultat_traduction->getMessage(), $requete_traduction)) |
: ''; |
if ( $resultat_traduction->numRows() != 0 ) { |
$ligne_traduction = $resultat_traduction->fetchRow(DB_FETCHMODE_OBJECT); |
if ( $retourultat_traduction->numRows() != 0 ) { |
$ligne_traduction = $retourultat_traduction->fetchRow(DB_FETCHMODE_OBJECT); |
$nom = $ligne_traduction->gs_nom; |
} else { |
$nom = $ligne['gs_nom']; |
} |
$resultat_traduction->free(); |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 3)). |
$retourultat_traduction->free(); |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 3)). |
'<option value="'.$ligne[$champs_code_site].'">'.$nom.'</option>'."\n"; |
} |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
'</select>'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 2)). |
'<input type="submit" value="'.$etiquette_bouton_valider.'"/>'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 1)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 1)). |
'</fieldset>'."\n"; |
$res .= str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * 0)). |
'</form>'."\n"; |
} |
$resultat->free(); |
$retourultat->free(); |
|
return $res; |
return $retour; |
} |
|
// +------------------------------------------------------------------------------------------------------+ |
165,6 → 180,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.3 2004/07/06 17:07:16 jpm |
* Modification de la documentation pour une mailleur analyse par PhpDocumentor. |
* |
* Revision 1.2 2004/06/21 07:37:50 alex |
* Modification d'un label |
* |