PEEL Shopping
Open source ecommerce : PEEL Shopping
positions.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: positions.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('IN_PEEL_ADMIN', true);
15 include("../configuration.inc.php");
17 necessite_priv("admin_products");
18 
19 $GLOBALS['DOC_TITLE'] = $GLOBALS['STR_ADMIN_POSITIONS_TITLE'];
20 include($GLOBALS['repertoire_modele'] . "/admin_haut.php");
21 
22 affiche_liste_position(vb($_GET['catid']));
23 
24 switch (vb($_REQUEST['mode'])) {
25  case "positionner" :
26  if (!verify_token($_SERVER['PHP_SELF'] . $_GET['catid'])) {
27  echo $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => $GLOBALS['STR_INVALID_TOKEN']))->fetch();
28  } elseif (!empty($_POST['id'])) {
29  foreach($_POST['id'] as $i => $prodid) {
30  query("UPDATE peel_produits
31  SET position = '" . intval($_POST['position'][$i]) . "'
32  WHERE id = '" . intval($prodid) . "' AND " . get_filter_site_cond('produits', null, true) . "");
33  }
34  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_ADMIN_POSITIONS_MSG_UPDATED_OK']))->fetch();
35  }
36  affiche_formulaire_modif_position($_POST['catid']);
37  break;
38 
39  case "modif" :
40  default :
41  affiche_formulaire_modif_position(vb($_GET['catid']));
42  break;
43 }
44 
45 include($GLOBALS['repertoire_modele'] . "/admin_bas.php");
46 
58 {
59  if (empty($catid)) {
60  return false;
61  }
62  $sql = "SELECT p.*
63  FROM peel_produits p
64  INNER JOIN peel_produits_categories pc ON pc.categorie_id = '" . intval($catid) . "'
65  WHERE pc.produit_id = p.id AND " . get_filter_site_cond('produits', 'p', true) . "
66  ORDER BY position";
67  $resProd = query($sql);
68 
69  $tpl = $GLOBALS['tplEngine']->createTemplate('admin_formulaire_modif_position.tpl');
70  $tpl->assign('action', get_current_url(false) . '?mode=modif&catid=' . $_GET['catid']);
71  $tpl->assign('form_token', get_form_token_input($_SERVER['PHP_SELF'] . $catid));
72  $tpl->assign('catid', intval($catid));
73  $tpl->assign('category_name', get_category_name($catid));
74 
75  $tpl_results = array();
76  $i = 0;
77  while ($prod = fetch_assoc($resProd)) {
78  $product_object = new Product($prod['id'], $prod, true, null, true, !check_if_module_active('micro_entreprise'));
79  $tpl_results[] = array('tr_rollover' => tr_rollover($i, true),
80  'value' => intval($product_object->id),
81  'modif_href' => 'produits.php?mode=modif&id=' . $product_object->id,
82  'name' => $product_object->name,
83  'prix' => fprix($product_object->prix, true, $GLOBALS['site_parameters']['code'], false),
84  'position' => $product_object->position
85  );
86  unset($product_object);
87  $i++;
88  }
89  $tpl->assign('results', $tpl_results);
90  $tpl->assign('STR_ADMIN_POSITIONS_FORM_EXPLAIN', $GLOBALS['STR_ADMIN_POSITIONS_FORM_EXPLAIN']);
91  $tpl->assign('STR_PRODUCT', $GLOBALS['STR_PRODUCT']);
92  $tpl->assign('STR_PRICE', $GLOBALS['STR_PRICE']);
93  $tpl->assign('STR_ADMIN_POSITION', $GLOBALS['STR_ADMIN_POSITION']);
94  $tpl->assign('STR_ADMIN_POSITIONS_POSITION_PRODUCTS', $GLOBALS['STR_ADMIN_POSITIONS_POSITION_PRODUCTS']);
95  echo $tpl->fetch();
96 }
97 
98 function maj_position($id, $frm, $img)
99 {
100 }
101 
108 function affiche_liste_position($categorie_id)
109 {
110  $tpl = $GLOBALS['tplEngine']->createTemplate('admin_liste_position.tpl');
111  $tpl->assign('categorie_options', get_categories_output(null, 'categories', $categorie_id));
112  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
113  $tpl->assign('STR_ADMIN_POSITIONS_LIST_TITLE', $GLOBALS['STR_ADMIN_POSITIONS_LIST_TITLE']);
114  $tpl->assign('STR_ADMIN_POSITIONS_LIST_EXPLAIN', $GLOBALS['STR_ADMIN_POSITIONS_LIST_EXPLAIN']);
115  $tpl->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
116  echo $tpl->fetch();
117 }
118 
if(isset($_GET['catid'])&&empty($_GET['catid'])) if(empty($_GET['catid'])&&!empty($GLOBALS['site_parameters']['disallow_main_category'])&&empty($_GET['convert_gift_points'])) $catid
Definition: index.php:26
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']
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
get_category_name($id)
Renvoie le nom d'une catégorie de produits.
Definition: fonctions.php:912
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(empty($_GET['id'])) if(!empty($GLOBALS['site_parameters']['allow_multiple_product_url_with_category'])) $product_object
$GLOBALS['DOC_TITLE']
Definition: positions.php:19
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
Definition: fonctions.php:1575
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
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
Definition: fonctions.php:1596
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
affiche_formulaire_modif_position($catid)
FONCTIONS.
Definition: positions.php:57
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
Definition: fonctions.php:94
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...
Definition: fonctions.php:118
$id
Definition: articles.php:22
fprix($price, $display_currency=false, $currency_code_or_default=null, $convertion_needed_into_currency=true, $currency_rate=null, $display_iso_currency_code=false, $format=true, $force_format_separator=null, $add_rdfa_properties=false, $round_even_if_no_format=false)
fprix formatte le prix donné en le convertissant si nécessaire au préalable et en ajoutant éventuelle...
Definition: fonctions.php:242
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...
affiche_liste_position($categorie_id)
affiche_liste_position()
Definition: positions.php:108
maj_position($id, $frm, $img)
Definition: positions.php:98

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