[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: box_produits.php,v 1.12 2005/06/27 21:25:17 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_produits.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/includes/boxes/box_produits.php 26 \ingroup produits,services 27 \brief Module de génération de l'affichage de la box produits 28 */ 29 30 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 31 32 33 class box_produits extends ModeleBoxes { 34 35 var $boxcode="lastproducts"; 36 var $boximg="object_product"; 37 var $boxlabel; 38 var $depends = array("produit"); 39 40 var $info_box_head = array(); 41 var $info_box_contents = array(); 42 43 44 /** 45 * \brief Constructeur de la classe 46 */ 47 function box_produits() 48 { 49 global $langs; 50 $langs->load("boxes"); 51 52 $this->boxlabel=$langs->trans("BoxLastProducts"); 53 } 54 55 /** 56 * \brief Charge les données en mémoire pour affichage ultérieur 57 * \param $max Nombre maximum d'enregistrements à charger 58 */ 59 function loadBox($max=5) 60 { 61 global $user, $langs, $db; 62 $langs->load("boxes"); 63 64 $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts",$max)); 65 66 if ($user->rights->produit->lire) 67 { 68 $sql = "SELECT p.label, p.rowid, p.price, p.fk_product_type"; 69 $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; 70 $sql .= " ORDER BY p.datec DESC"; 71 $sql .= $db->plimit($max, 0); 72 73 $result = $db->query($sql); 74 if ($result) 75 { 76 $num = $db->num_rows($result); 77 $i = 0; 78 while ($i < $num) 79 { 80 $objp = $db->fetch_object($result); 81 82 $this->info_box_contents[$i][0] = array('align' => 'left', 83 'logo' => ($objp->fk_product_type?'object_service':'object_product'), 84 'text' => $objp->label, 85 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); 86 87 $this->info_box_contents[$i][1] = array('align' => 'right', 88 'text' => price($objp->price)); 89 $i++; 90 } 91 } 92 else { 93 dolibarr_print_error($db); 94 } 95 } 96 else { 97 $this->info_box_contents[0][0] = array('align' => 'left', 98 'text' => $langs->trans("ReadPermissionNotAllowed")); 99 } 100 } 101 102 function showBox() 103 { 104 parent::showBox($this->info_box_head, $this->info_box_contents); 105 } 106 107 } 108 109 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |