PEEL Shopping
Open source ecommerce : PEEL Shopping
fonctions.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: fonctions.php 46935 2015-09-18 08:49:48Z gboussin $
14 if (!defined('IN_PEEL')) {
15  die();
16 }
17 
24 function tagcloud_hook_admin_menu_items($params) {
25  $result['menu_items']['content_general'][$GLOBALS['wwwroot_in_admin'] . '/modules/tagcloud/administrer/tagcloud.php'] = $GLOBALS["STR_ADMIN_MENU_CONTENT_TAGCLOUD"];
26  $result['menu_items']['content_various'][$GLOBALS['wwwroot_in_admin'] . '/modules/tagcloud/administrer/tagcloud.php'] = $GLOBALS["STR_ADMIN_MENU_CONTENT_TAGCLOUD"];
27  return $result;
28 }
29 
37 {
38  /* Valeurs par défaut */
39  if(empty($frm)) {
40  $frm = array();
41  $frm['tag_name'] = "";
42  $frm['nbsearch'] = "";
43  }
44  $frm['id'] = "";
45  $frm['nouveau_mode'] = "insere";
46  $frm['lang'] = $_SESSION['session_langue'];
47  $frm["titre"] = $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_ADD_SEARCH'];
48  $frm['titre_bouton'] = $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_CREATE'];
49 
51 }
52 
61 {
62  if(empty($frm)){
63  // Pas de données venant de validation de formulaire, donc on charge le contenu de la base de données
64  /* Charge les informations de la recherche */
65  $qid = query("SELECT *
66  FROM peel_tag_cloud
67  WHERE id=" . intval($id) . " AND " . get_filter_site_cond('tag_cloud', null, true));
68  $frm = fetch_assoc($qid);
69  }
70  $frm['id'] = $id;
71  $frm["nouveau_mode"] = "maj";
72  $frm["titre"] = $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_MODIFY_THIS_TAG'];
73  $frm["titre_bouton"] = $GLOBALS['STR_ADMIN_FORM_SAVE_CHANGES'];
74 
76 }
77 
85 {
86  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/tagcloudAdmin_formulaire_recherche.tpl');
87  $tpl->assign('action', get_current_url(false) . '?start=0');
88  $tpl->assign('mode', $frm["nouveau_mode"]);
89  $tpl->assign('id', intval($frm['id']));
90  $tpl->assign('tag_name', $frm["tag_name"]);
91  $tpl->assign('nbsearch', $frm["nbsearch"]);
92  $tpl->assign('titre_bouton', $frm["titre_bouton"]);
93  $tpl->assign('titre', $frm["titre"]);
94  $tpl_options = array();
95  $sql = "SELECT lang, nom_" . $_SESSION['session_langue'] . " AS name
96  FROM peel_langues
97  WHERE " . get_filter_site_cond('langues', null, true);
98  $query = query($sql);
99  while ($lang = fetch_object($query)) {
100  $tpl_options[] = array(
101  'value' => $lang->lang,
102  'issel' => $frm["lang"] == $lang->lang,
103  'name' => $lang->name
104  );
105  }
106  $tpl->assign('options', $tpl_options);
107  $tpl->assign('site_id_select_options', get_site_id_select_options(vb($frm['site_id'])));
108  $tpl->assign('STR_ADMIN_WEBSITE', $GLOBALS['STR_ADMIN_WEBSITE']);
109  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
110  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_TAG_NAME', $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_TAG_NAME']);
111  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_SEARCHES_COUNT', $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_SEARCHES_COUNT']);
112  $tpl->assign('STR_ADMIN_LANGUAGE', $GLOBALS['STR_ADMIN_LANGUAGE']);
113  echo $tpl->fetch();
114 }
115 
123 {
124  query("DELETE FROM peel_tag_cloud
125  WHERE id=" . intval($id) . " AND " . get_filter_site_cond('tag_cloud', null, true));
126  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_MODULE_TAGCLOUD_ADMIN_MSG_SEARCH_DELETED_OK']))->fetch();
127 }
128 
136 {
137  query("INSERT INTO peel_tag_cloud (
138  tag_name
139  , lang
140  , nbsearch
141  , site_id
142  ) VALUES (
143  '" . nohtml_real_escape_string($frm['tag_name']) . "'
144  ,'" . nohtml_real_escape_string($frm['lang']) . "'
145  ,'" . nohtml_real_escape_string($frm['nbsearch']) . "'
147  )");
148 }
149 
158 {
159  query("UPDATE peel_tag_cloud
160  SET tag_name = '" . nohtml_real_escape_string($frm['tag_name']) . "',
161  lang = '" . nohtml_real_escape_string($frm['lang']) . "',
162  nbsearch = '" . nohtml_real_escape_string($frm['nbsearch']) . "',
163  site_id = '" . nohtml_real_escape_string(get_site_id_sql_set_value($frm['site_id'])) . "'
164  WHERE id = " . intval($id) . " AND " . get_filter_site_cond('tag_cloud', null, true));
165 }
166 
174 {
175  $sql = "SELECT *
176  FROM peel_tag_cloud
177  WHERE " . get_filter_site_cond('tag_cloud', null, true) . "
178  ORDER BY nbsearch DESC";
179  $Links = new Multipage($sql, 'tagcloud');
180  $results_array = $Links->query();
181 
182  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/tagcloudAdmin_liste_recherche.tpl');
183  $tpl->assign('add_src', $GLOBALS['administrer_url'] . '/images/add.png');
184  $tpl->assign('add_href', get_current_url(false) . '?mode=ajout');
185  $tpl->assign('drop_src', $GLOBALS['administrer_url'] . '/images/b_drop.png');
186  $tpl->assign('edit_src', $GLOBALS['administrer_url'] . '/images/b_edit.png');
187 
188  if (!empty($results_array)) {
189  $tpl_results = array();
190  $i = 0;
191  foreach ($results_array as $ligne) {
192  $tpl_results[] = array(
193  'tr_rollover' => tr_rollover($i, true),
194  'tag_name' => $ligne['tag_name'],
195  'drop_href' => get_current_url(false) . '?mode=suppr&id=' . $ligne['id'],
196  'edit_href' => get_current_url(false) . '?mode=modif&id=' . $ligne['id'],
197  'lang' => $ligne['lang'],
198  'nbsearch' => $ligne['nbsearch'],
199  );
200  $i++;
201  }
202  $tpl->assign('results', $tpl_results);
203  }
204  $tpl->assign('links_multipage', $Links->GetMultipage());
205  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_LIST_TITLE', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_LIST_TITLE"]);
206  $tpl->assign('STR_ADMIN_DELETE_WARNING', $GLOBALS["STR_ADMIN_DELETE_WARNING"]);
207  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_NOTHING_FOUND', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_NOTHING_FOUND"]);
208  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_ADD_SEARCH', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_ADD_SEARCH"]);
209  $tpl->assign('STR_ADMIN_ACTION', $GLOBALS["STR_ADMIN_ACTION"]);
210  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_TAG_NAME', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_TAG_NAME"]);
211  $tpl->assign('STR_ADMIN_LANGUAGE', $GLOBALS["STR_ADMIN_LANGUAGE"]);
212  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_SEARCH_COUNT', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_SEARCH_COUNT"]);
213  $tpl->assign('STR_DELETE', $GLOBALS["STR_DELETE"]);
214  $tpl->assign('STR_MODULE_TAGCLOUD_ADMIN_MODIFY_THIS_TAG', $GLOBALS["STR_MODULE_TAGCLOUD_ADMIN_MODIFY_THIS_TAG"]);
215  echo $tpl->fetch();
216 }
217 
218 
226 {
227  $r_tag = query("SELECT *
228  FROM peel_tag_cloud
229  WHERE id = '".intval($id)."' AND " . get_filter_site_cond('tag_cloud', null, true));
230  if ( !empty($r_tag) ) {
231  $tag = fetch_assoc($r_tag);
232  } else {
233  $tag = null;
234  }
235  return $tag;
236 }
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
$lang
Definition: spellchecker.php:9
$result
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
if(!defined('IN_PEEL')) tagcloud_hook_admin_menu_items($params)
Renvoie les éléments de menu affichables.
Definition: fonctions.php:24
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.
get_tag_cloud($id)
get_tag_cloud()
Definition: fonctions.php:225
supprime_recherche($id)
Efface la recherche.
Definition: fonctions.php:122
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 ...
Definition: database.php:400
$results_array
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
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
Definition: fonctions.php:19
$start
Definition: attributs.php:22
affiche_formulaire_modif_recherche($id, &$frm)
Affiche le formulaire de modification pour la recherche sélectionné
Definition: fonctions.php:60
$tpl_options
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.
Definition: fonctions.php:4643
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.
Definition: database.php:158
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
fetch_object($query_result)
fetch_object()
Definition: database.php:302
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
affiche_formulaire_ajout_recherche(&$frm)
Affiche un formulaire vierge pour ajouter une recherche.
Definition: fonctions.php:36
affiche_formulaire_recherche(&$frm)
affiche_formulaire_recherche()
Definition: fonctions.php:84
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.
Definition: fonctions.php:4747
$id
Definition: articles.php:22
maj_recherche($id, $frm)
Met à jour la recherche $id avec de nouvelles valeurs.
Definition: fonctions.php:157
insere_recherche($frm)
Ajoute la zone dans la table zone.
Definition: fonctions.php:135
affiche_liste_recherche($start)
affiche_liste_recherche()
Definition: fonctions.php:173
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:31:04 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.