Subversion Repositories Applications.papyrus

Rev

Rev 1467 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1467 Rev 1680
Line 8... Line 8...
8
// | Les fonctions de annuaire_moteur.php                                           |
8
// | Les fonctions de annuaire_moteur.php                                           |
9
// +--------------------------------------------------------------------------------+
9
// +--------------------------------------------------------------------------------+
10
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> 		  		        |
10
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> 		  		        |
11
// +--------------------------------------------------------------------------------+
11
// +--------------------------------------------------------------------------------+
12
//
12
//
13
// $Id: annuaire_backoffice.fonct.php,v 1.12 2007-06-25 09:59:03 alexandre_tb Exp $
13
// $Id: annuaire_backoffice.fonct.php,v 1.13 2007-11-08 09:26:20 alexandre_tb Exp $
Line 14... Line 14...
14
 
14
 
15
 
15
 
16
/** function mkengine ()
16
/** function mkengine ()
Line 23... Line 23...
23
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php' ;
23
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php' ;
24
include_once PAP_CHEMIN_API_PEAR.'HTML/Table.php';
24
include_once PAP_CHEMIN_API_PEAR.'HTML/Table.php';
Line 25... Line 25...
25
 
25
 
26
function mkengine()
26
function mkengine()
27
  {
-
 
28
    global $nbr_total;
27
  {
Line 29... Line 28...
29
    global $bouton, $HTTP_POST_VARS ;
28
    global $bouton, $HTTP_POST_VARS ;
30
    
29
    
-
 
30
    $requete = mkquery() ;
31
    $requete = mkquery() ;
31
    //$ret = '<div>'. $requete .'</div>';
Line 32... Line 32...
32
    $ret = '<div>'. $requete .'</div>';
32
    $ret = '';
33
    // Deux requetes, une avec tous les resultats, l'autre avec les résultats affichés
33
    // Deux requetes, une avec tous les resultats, l'autre avec les resultats affiches
34
 
34
 
35
    $result_final = $GLOBALS['ins_db']->query($requete) ;
35
    $result_final = $GLOBALS['ins_db']->query($requete) ;
Line 90... Line 90...
90
 
90
 
91
  	//$ret = '';
91
  	//$ret = '';
92
	$ret .= '<h1>'.AM_L_TITRE.' '.$chaine.'</h1>'."\n" ;
92
	$ret .= '<h1>'.AM_L_TITRE.' '.$chaine.'</h1>'."\n" ;
Line 93... Line 93...
93
  // construction du moteur de str
93
  // construction du moteur de str
94
 
-
 
95
    $ret .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post">'."\n";
94
 
96
    $ret .= '<table summary="recherche">'."\n";
-
 
97
    
-
 
98
    // ligne de recherche
-
 
99
    $ret .= "<tr>\n";
95
 	$url = $GLOBALS['ins_url']->getURL();
100
    $ret .= "<td>".AM_L_RECHERCHER." :\n</td>\n<td>";
-
 
101
    $ret .= form_mk_chaineI(isset ($_REQUEST['recherche']) ? stripslashes($_REQUEST['recherche']) : '', "recherche")."&nbsp;";
96
   
102
    $ret .= '</td><td colspan="4">'.AM_L_PAYS." : \n" ;
97
    isset ($_REQUEST['recherche']) ? $recherche = stripslashes($_REQUEST['recherche']) : $recherche = '';
103
    
98
   
104
    // formulaire contenant les pays, avec par defaut soit le pays en cours
99
    // formulaire contenant les pays, avec par defaut soit le pays en cours
105
    // soit "tous les pays"
100
    // soit "tous les pays"
Line 106... Line -...
106
    $liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
-
 
107
    $tableau_pays = $liste_pays->getListePays(INS_LANGUE_DEFAUT) ;
-
 
108
    
101
    $liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
109
    $ret .= "<select name=\"pays\">\n" ;
-
 
110
    $ret .= "<option value=\"tous\">Tous les pays</option>\n" ;
102
    $tableau_pays = $liste_pays->getListePays(INS_LANGUE_DEFAUT) ;
111
    foreach ($tableau_pays as $codeIso => $labelPays) {
103
    
112
        $ret .= '<option value="'.$codeIso.'"' ;
104
    foreach ($tableau_pays as $codeIso => $labelPays) {
113
        if (!empty($pays)) {
-
 
114
                if ($pays == $codeIso) $ret .= " selected" ;
105
        if (!empty($pays)) {
115
        }
-
 
116
        $ret .= '>'.$labelPays.'</option>'."\n" ;
-
 
117
    }
106
                $pays = $_REQUEST['pays'];
118
    $ret .= "</select>\n" ;
-
 
119
    $ret .= "</td></tr>\n" ;
-
 
120
  
-
 
121
	$ret .= "<tr>\n";
-
 
122
    $ret .= "<td>".AM_L_NOM." :\n</td><td>";
-
 
123
    $ret .= form_mk_chaineI(isset ($_REQUEST['nom']) ? stripslashes($_REQUEST['nom']) : '', "nom")."&nbsp;</td>\n<td>" ;
-
 
124
    $ret .= AM_L_PRENOM."&nbsp;:</td>\n<td>".form_mk_chaineI(isset ($_REQUEST['prenom']) ? stripslashes($_REQUEST['prenom']) : '', "prenom")."&nbsp;</td>\n<td class=\"insLabel\">" ;
-
 
125
    $ret .= AM_L_VILLE."&nbsp;:</td>\n<td>".form_mk_chaineI(isset ($_REQUEST['ville']) ? stripslashes($_REQUEST['ville']) : '', "ville")."&nbsp;</td>" ;
-
 
126
    $ret .= "</tr><tr>\n" ;
107
        }
127
    $ret .= "<td>".AM_L_DEPARTEMENT."&nbsp;: </td>\n<td>" ;
108
    }
128
    
109
 
129
    // Construction du <select> des departements
110
    // Construction du <select> des departements
130
    $requete_dpt = 'select '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' from '.INS_TABLE_DPT ;
111
    $requete_dpt = 'select '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' from '.INS_TABLE_DPT ;
131
    $resultat_dpt = $GLOBALS['ins_db']->query($requete_dpt) ;
112
    $resultat_dpt = $GLOBALS['ins_db']->query($requete_dpt) ;
132
    if (DB::isError($resultat_dpt)) {
-
 
133
    	echo 'Echec de la requete<br />'.$requete_dpt.'<br />'.$resultat_dpt->getMessage();	
-
 
-
 
113
    if (DB::isError($resultat_dpt)) {
134
    }
114
    	echo 'Echec de la requete<br />'.$requete_dpt.'<br />'.$resultat_dpt->getMessage();	
135
    $ret .= "<select name=\"dept\">\n" ;
115
    }
136
    $ret .= "<option value=\"tous\">tous</option>\n" ;
116
  
137
    while ($ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC)) {
117
    while ($ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
118
        $tableau_dpt[$ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT];
138
        $ret .= '<option value="'.$ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT].'"' ;
119
        if (isset ($_REQUEST['dept']) && $_REQUEST['dept'] == $ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT]) {
139
        if (isset ($_REQUEST['dept']) && $_REQUEST['dept'] == $ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT]) $ret .= " selected" ;
-
 
140
        $ret .= '>'.$ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT].' - '.$ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT].'</option>'."\n" ;
120
        	$dpt = $_REQUEST['dept'];	
141
    }
121
        }
142
    $ret .= "</select></td>\n" ;
-
 
143
    
-
 
144
    $ret .= '<td>'.AM_L_MAIL.'&nbsp;: </td><td colspan="3">'.form_mk_chaineI(isset ($_REQUEST['mail']) ? stripslashes($_REQUEST['mail']) : '', "mail")."</td>\n" ;
-
 
145
    $ret .= "</tr>" ;
122
    }
146
    
-
 
147
    // Les statuts des inscrits
123
 
148
 
-
 
149
    $ret .= "<tr>\n";
-
 
150
    $ret .= "<td>\n";
-
 
151
    $ret .= AM_L_GRP_RES." : </td>" ;
124
    $pager_select_box = $pager->getperpageselectbox (50 , 200, 50 , false ,'%d');
152
    $ret .= '<td>'.$pager->getperpageselectbox (50 , 200, 50 , false ,'%d').'</td>'."\n" ;
125
  
153
    $ret .= '<td colspan="4">'."\n";
-
 
154
    $ret .= "<input type=\"submit\" value=\"".AM_L_RECHERCHER."\" name =\"bouton\">\n";
126
    ob_start();
Line 155... Line 127...
155
    $ret .= "</td></tr></table></form>\n";
127
    include_once INS_CHEMIN_SQUELETTE.INS_FICHIER_SQUELETTE_BACKOFFICE_MOTEUR ;
156
    
128
    $ret .= ob_get_contents();
157
    $ret .= "\n<div>" ;
129
    ob_end_clean();
158
    
130
    
Line 164... Line 136...
164
        $ret .= chr($i) ;
136
        $ret .= chr($i) ;
165
        $ret .= "</a> \n";
137
        $ret .= "</a> \n";
166
	}
138
	}
167
	$GLOBALS['ins_url']->addQueryString ('lettre', 'tous') ;
139
	$GLOBALS['ins_url']->addQueryString ('lettre', 'tous') ;
168
	$ret .= " <a href=\"".$GLOBALS['ins_url']->getURL().'">'.AM_L_TOUS."</a>\n" ;
140
	$ret .= " <a href=\"".$GLOBALS['ins_url']->getURL().'">'.AM_L_TOUS."</a>\n" ;
169
    $ret .= "</div>\n" ;
141
    //$ret .= "</div>\n" ;
170
    $ret .= '<div>'.$nbr_final.' r&eacute;sultat(s)</div>' ;
142
    $ret .= '<div>'.$nbr_final.' r&eacute;sultat(s)</div>' ;
171
    $GLOBALS['ins_url']->removeQueryString('lettre') ;
143
    $GLOBALS['ins_url']->removeQueryString('lettre') ;
Line 172... Line 144...
172
    
144
    
173
    // Menu Ajouter un inscrit
145
    // Menu Ajouter un inscrit
Line 207... Line 179...
207
		        if (DB::isError($resultat_dpt)) {
179
		        if (DB::isError($resultat_dpt)) {
208
		        	echo $resultat_dpt->getMessage().$resultat_dpt->getDebugInfo();		        	
180
		        	echo $resultat_dpt->getMessage().$resultat_dpt->getDebugInfo();		        	
209
		        }
181
		        }
210
		        $ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC) ;
182
		        $ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC) ;
211
				array_push ($ligne_inscrit, $ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT]) ;
183
				array_push ($ligne_inscrit, $ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT]) ;
212
				$GLOBALS['ins_url']->addQueryString(ANN_VARIABLE_ACTION, ANN_ACTION_SUPPRIMER_INSCRIT);
-
 
213
				$GLOBALS['ins_url']->addQueryString(INS_VARIABLE_ID_INSCRIT, $data[$i][INS_CHAMPS_ID]);
-
 
214
				array_push ($ligne_inscrit, '<a href="'.$GLOBALS['ins_url']->getURL().
-
 
215
						'" onclick="javascript:return confirm(\''.INS_SUPPRIMER.' ?\');">'.INS_SUPPRIMER.'</a>');
-
 
-
 
184
				
216
			}
185
			}
-
 
186
			$GLOBALS['ins_url']->addQueryString(ANN_VARIABLE_ACTION, ANN_ACTION_SUPPRIMER_INSCRIT);
-
 
187
			$GLOBALS['ins_url']->addQueryString(INS_VARIABLE_ID_INSCRIT, $data[$i][INS_CHAMPS_ID]);
-
 
188
			array_push ($ligne_inscrit, '<a href="'.$GLOBALS['ins_url']->getURL().
-
 
189
					'" onclick="javascript:return confirm(\''.INS_SUPPRIMER.' ?\');">'.INS_SUPPRIMER.'</a>');
-
 
190
			$GLOBALS['ins_url']->removeQueryString(ANN_VARIABLE_ACTION);
-
 
191
			$GLOBALS['ins_url']->removeQueryString(INS_VARIABLE_ID_INSCRIT);
217
			
-
 
218
			$table->addRow($ligne_inscrit) ;
192
			$table->addRow($ligne_inscrit) ;
219
		}
193
		}
220
	}
194
	}
221
	$ret .= $table->toHTML();
195
	$ret .= $table->toHTML();
222
	$links = $pager->getLinks();
196
	$links = $pager->getLinks();
Line 226... Line 200...
226
    			.'">'.AM_L_MAIL_SELECTION."</a></div>\n" ;
200
    			.'">'.AM_L_MAIL_SELECTION."</a></div>\n" ;
Line 227... Line 201...
227
 
201
 
228
    return $ret;
202
    return $ret;
Line 229... Line -...
229
}
-
 
230
 
-
 
231
/** function form_mk_chaineI () Renvoie une balise de type <input>
-
 
232
*
-
 
233
*   @param  string  l'attribut value de la balise
-
 
234
*   @param  string  l'attibut name de la balise
-
 
235
*   @param  string  la classe CSS
-
 
236
*   @return string  HTML
-
 
237
*/
-
 
238
function form_mk_chaineI($value="", $name, $class="insInputForm")
-
 
239
{
-
 
240
    return "<input type=\"text\" size=\"15\" value=\"$value\" name=\"$name\" class=\"$class\">";
-
 
241
}
-
 
242
 
-
 
243
function form_mk_select($value="", $name="", $class="insInputForm") {
-
 
244
	$res = "<select name=\"$name\" class=\"$class\">\n" ;
-
 
245
	$res .= "<option value=\"1\"" ;
-
 
246
	if ($value == 1) $res .= " selected" ;
-
 
247
	$res .= ">Cotisants</option>\n" ;
-
 
248
	$res .= "<option value=\"2\"" ;
-
 
249
	if ($value == 2) $res .= " selected" ;
-
 
250
	$res .= ">Non cotisants</option>\n" ;
-
 
251
	$res .= "<option value=\"3\"" ;	
-
 
252
	if ($value == 3 || $value == "") $res .= " selected" ;
-
 
253
	$res .= ">Tous</option>\n" ;
-
 
254
	$res .= "</select>\n" ;
-
 
Line 255... Line 203...
255
	return $res ;
203
}
256
  }
204
 
Line 257... Line 205...
257
 
205