14 define(
'IN_PEEL_ADMIN',
true);
15 include(
"../configuration.inc.php");
25 switch (
vb($_REQUEST[
'mode'])) {
45 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_TYPES_MSG_CREATED_OK'],
vb($_POST[
'nom_' .
$_SESSION[
"session_langue"]]))))->fetch();
56 if (!
verify_token($_SERVER[
'PHP_SELF'] . $frm[
'mode'] . $frm[
'id'])) {
61 $output .=
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_TYPES_MSG_UPDATED_OK'],
vn($_POST[
'id']))))->fetch();
75 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_haut.php");
77 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_bas.php");
96 $frm[
'without_delivery_address'] = 0;
97 $frm[
'is_socolissimo'] = 0;
98 $frm[
'is_icirelais'] = 0;
99 $frm[
'tnt_threshold'] = 0;
101 $frm[
'fianet_type_transporteur'] = 0;
102 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
103 $frm[
'nom_' . $lng] =
"";
106 $frm[
'nouveau_mode'] =
"insere";
108 $frm[
'titre_bouton'] =
$GLOBALS[
'STR_ADMIN_TYPES_CREATE'];
125 $qid =
query(
"SELECT *
132 $frm[
"nouveau_mode"] =
"maj";
133 $frm[
"titre_bouton"] =
$GLOBALS[
'STR_ADMIN_FORM_SAVE_CHANGES'];
148 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_formulaire_type.tpl');
151 $tpl->assign(
'mode',
vb(
$frm[
'nouveau_mode']));
154 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
156 'nom' =>
$frm[
'nom_' . $lng]
160 $tpl->assign(
'position',
$frm[
'position']);
162 $tpl->assign(
'without_delivery_address',
$frm[
'without_delivery_address']);
165 $tpl->assign(
'is_socolissimo',
$frm[
'is_socolissimo']);
169 $tpl->assign(
'is_icirelais',
$frm[
'is_icirelais']);
173 $tpl->assign(
'tnt_threshold',
vb(
$frm[
'tnt_threshold']));
175 $tpl->assign(
'fianet_type_transporteur',
vb(
$frm[
'fianet_type_transporteur']));
176 $tpl->assign(
'titre_bouton',
$frm[
'titre_bouton']);
178 $tpl->assign(
'STR_ADMIN_WEBSITE',
$GLOBALS[
'STR_ADMIN_WEBSITE']);
179 $tpl->assign(
'STR_ADMIN_TYPES_LINK_TO_SOCOLISSIMO',
$GLOBALS[
'STR_ADMIN_TYPES_LINK_TO_SOCOLISSIMO']);
180 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
181 $tpl->assign(
'STR_ADMIN_TYPES_FORM_TITLE',
$GLOBALS[
'STR_ADMIN_TYPES_FORM_TITLE']);
182 $tpl->assign(
'STR_ADMIN_LANGUAGES_SECTION_HEADER',
$GLOBALS[
'STR_ADMIN_LANGUAGES_SECTION_HEADER']);
183 $tpl->assign(
'STR_ADMIN_NAME',
$GLOBALS[
'STR_ADMIN_NAME']);
184 $tpl->assign(
'STR_ADMIN_VARIOUS_INFORMATION_HEADER',
$GLOBALS[
'STR_ADMIN_VARIOUS_INFORMATION_HEADER']);
185 $tpl->assign(
'STR_ADMIN_POSITION',
$GLOBALS[
'STR_ADMIN_POSITION']);
187 $tpl->assign(
'STR_ADMIN_ONLINE',
$GLOBALS[
'STR_ADMIN_ONLINE']);
188 $tpl->assign(
'STR_ADMIN_OFFLINE',
$GLOBALS[
'STR_ADMIN_OFFLINE']);
189 $tpl->assign(
'STR_SHIP_ADDRESS',
$GLOBALS[
'STR_SHIP_ADDRESS']);
191 $tpl->assign(
'STR_ADMIN_TYPES_NO_DELIVERY',
$GLOBALS[
'STR_ADMIN_TYPES_NO_DELIVERY']);
193 $tpl->assign(
'STR_ADMIN_TYPES_LINK_TO_ICIRELAIS',
$GLOBALS[
'STR_ADMIN_TYPES_LINK_TO_ICIRELAIS']);
194 $tpl->assign(
'STR_ADMIN_TYPES_TNT',
$GLOBALS[
'STR_ADMIN_TYPES_TNT']);
195 $tpl->assign(
'STR_ADMIN_TYPES_LINK_TO_TNT',
$GLOBALS[
'STR_ADMIN_TYPES_LINK_TO_TNT']);
196 $tpl->assign(
'STR_ADMIN_TYPES_TNT_DESTINATION',
$GLOBALS[
'STR_ADMIN_TYPES_TNT_DESTINATION']);
197 $tpl->assign(
'STR_ADMIN_TYPES_TNT_HOME',
$GLOBALS[
'STR_ADMIN_TYPES_TNT_HOME']);
198 $tpl->assign(
'STR_ADMIN_TYPES_TNT_DELIVERY_POINT',
$GLOBALS[
'STR_ADMIN_TYPES_TNT_DELIVERY_POINT']);
199 $tpl->assign(
'STR_ADMIN_TYPES_KWIXO',
$GLOBALS[
'STR_ADMIN_TYPES_KWIXO']);
200 $tpl->assign(
'STR_ADMIN_TYPES_LINK_TO_KWIXO',
$GLOBALS[
'STR_ADMIN_TYPES_LINK_TO_KWIXO']);
201 $tpl->assign(
'STR_ADMIN_TYPES_LINK_TO_KWIXO_EXPLAIN',
$GLOBALS[
'STR_ADMIN_TYPES_LINK_TO_KWIXO_EXPLAIN']);
202 return $tpl->fetch();
214 query(
"DELETE FROM peel_types
227 $sql =
"INSERT INTO peel_types (position, site_id
228 , without_delivery_address, etat";
229 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
230 $sql .=
", nom_" . $lng;
233 $sql .=
", is_socolissimo";
236 $sql .=
", is_icirelais";
239 $sql .=
", fianet_type_transporteur";
243 $sql .=
", tnt_threshold";
247 , '" . intval(
$frm[
'without_delivery_address']) .
"'
248 , '" . intval(
$frm[
'etat']) .
"'";
249 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
253 $sql .=
", '" . intval(
$frm[
'is_socolissimo']) .
"'";
256 $sql .=
", '" . intval(
$frm[
'is_icirelais']) .
"'";
259 $sql .=
", '" . intval(
$frm[
'fianet_type_transporteur']) .
"'";
262 $sql .=
", '" . intval(
$frm[
'is_tnt']) .
"'";
263 $sql .=
", '" . intval(
$frm[
'tnt_threshold']) .
"'";
281 , without_delivery_address='" . intval(
$frm[
'without_delivery_address']) .
"'
282 , etat='" . intval(
vn(
$frm[
'etat'])) .
"'";
283 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
287 $sql .=
", is_socolissimo = '" . intval(
$frm[
'is_socolissimo']) .
"'";
290 $sql .=
", is_icirelais = '" . intval(
vn(
$frm[
'is_icirelais'])) .
"'";
293 $sql .=
", fianet_type_transporteur = '" . intval(
$frm[
'fianet_type_transporteur']) .
"'";
296 $sql .=
", is_tnt = '".intval(
$frm[
'is_tnt']).
"'";
297 $sql .=
", tnt_threshold = '".intval(
$frm[
'tnt_threshold']).
"'";
299 $sql .=
" WHERE id = '" . intval(
$id) .
"'";
310 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_liste_type.tpl');
311 $tpl->assign(
'add_src',
$GLOBALS[
'administrer_url'] .
'/images/add.png');
312 $tpl->assign(
'drop_src',
$GLOBALS[
'administrer_url'] .
'/images/b_drop.png');
313 $tpl->assign(
'edit_src',
$GLOBALS[
'administrer_url'] .
'/images/b_edit.png');
319 ORDER BY t.position");
321 $tpl_results = array();
324 $tpl_results[] = array(
'tr_rollover' => tr_rollover(
$i,
true, null, null,
'sortable_'.$ligne[
'id']),
325 'nom' => (!empty($ligne[
'nom_' .
$_SESSION[
'session_langue']])?$ligne[
'nom_' . $_SESSION[
'session_langue']]:
'['.$ligne[
'id'].
']'),
326 'drop_href' =>
get_current_url(
false) .
'?mode=suppr&id=' . $ligne[
'id'],
327 'modif_href' =>
get_current_url(
false) .
'?mode=modif&id=' . $ligne[
'id'],
328 'etat_onclick' =>
'change_status("types", "' . $ligne[
'id'] .
'", this, "'.
$GLOBALS[
'administrer_url'] .
'")',
329 'etat_src' => $GLOBALS[
'administrer_url'] .
'/images/' . (empty($ligne[
'etat']) ?
'puce-blanche.gif' :
'puce-verte.gif'),
330 'position' => $ligne[
'position'],
335 $tpl->assign(
'results', $tpl_results);
337 $GLOBALS[
'sortable_rpc'] =
'rpc_positions.php?mode=types';
338 $tpl->assign(
'STR_ADMIN_WEBSITE',
$GLOBALS[
'STR_ADMIN_WEBSITE']);
339 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
340 $tpl->assign(
'STR_ADMIN_TYPES_TITLE',
$GLOBALS[
'STR_ADMIN_TYPES_TITLE']);
341 $tpl->assign(
'STR_ADMIN_TYPES_EXPLAIN',
$GLOBALS[
'STR_ADMIN_TYPES_EXPLAIN']);
342 $tpl->assign(
'STR_ADMIN_TYPES_CREATE',
$GLOBALS[
'STR_ADMIN_TYPES_CREATE']);
343 $tpl->assign(
'STR_ADMIN_ACTION',
$GLOBALS[
'STR_ADMIN_ACTION']);
344 $tpl->assign(
'STR_SHIPPING_TYPE',
$GLOBALS[
'STR_SHIPPING_TYPE']);
345 $tpl->assign(
'STR_ADMIN_POSITION',
$GLOBALS[
'STR_ADMIN_POSITION']);
347 $tpl->assign(
'STR_ADMIN_DELETE_WARNING',
$GLOBALS[
'STR_ADMIN_DELETE_WARNING']);
349 $tpl->assign(
'STR_ADMIN_TYPES_UPDATE',
$GLOBALS[
'STR_ADMIN_TYPES_UPDATE']);
350 $tpl->assign(
'STR_ADMIN_TYPES_NOTHING_FOUND',
$GLOBALS[
'STR_ADMIN_TYPES_NOTHING_FOUND']);
351 return $tpl->fetch();
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id.
get_delivery_type_name($id)
get_delivery_type_name()
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
affiche_formulaire_ajout_type(&$frm)
FONCTIONS.
redirect_and_die($url, $permanent_redirection=false, $avoid_loop=false)
Redirige vers l'URL demandée et arrête le programme.
affiche_liste_type()
affiche_liste_type()
get_site_id_select_options($selected_site_id=null, $selected_site_name=null, $display_first_option=null, $select_current_site_id_by_default=false)
Créer les options pour le select qui liste les noms de sites configurés en back office.
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
affiche_formulaire_type(&$frm)
affiche_formulaire_type()
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
insere_type($frm)
Ajoute le type dans la table type.
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
num_rows($query_result)
num_rows()
supprime_type($id)
Supprime le type spécifié par $id.
fetch_assoc($query_result)
fetch_assoc()
affiche_formulaire_modif_type($id, &$frm)
Affiche le formulaire de modification pour le type sélectionné
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
maj_type($id, $frm)
Met à jour le type $id avec de nouvelles valeurs.
get_site_id_sql_set_value($site_ids)
Retourne la valeur SQL d'un champ INT ou SET suivant que ce soit un entier ou un tableau.
verify_token($name= 'general', $delay_in_minutes=60, $check_referer_if_set_by_server=true, $cancel_token=true, $minimum_wait_in_seconds_before_use=0)
Vérification de la validité d'un token Par défaut, un token est valide 1h, et utilisable 1 seule fois...
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']