[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/includes/boxes/ -> box_boutique_livre.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 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_boutique_livre.php,v 1.8 2005/06/27 21:25:17 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_boutique_livre.php,v $
  21   *
  22   */
  23  
  24  /**
  25      \file       htdocs/includes/boxes/box_boutique_livre.php
  26      \ingroup    boutique
  27      \brief      Module de génération de l'affichage de la box boutique livres
  28  */
  29  
  30  
  31  include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
  32  
  33  
  34  class box_boutique_livre extends ModeleBoxes {
  35  
  36      var $boxcode="lastbooks";
  37      var $boximg="object_book";
  38      var $boxlabel;
  39      var $depends = array("boutique");
  40  
  41      var $info_box_head = array();
  42      var $info_box_contents = array();
  43  
  44      /**
  45       *      \brief      Constructeur de la classe
  46       */
  47      function box_boutique_livre()
  48      {
  49          global $langs;
  50          $langs->load("boxes");
  51  
  52          $this->boxlabel=$langs->trans("BoxLastBooks");
  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("BoxTitleLastBooks",$max));
  65      
  66          if ($user->rights->boutique->lire)
  67          {
  68              $sql = "SELECT l.ref, l.title, l.rowid";
  69              $sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
  70              $sql .= " ORDER BY l.date_ajout DESC ";
  71              $sql .= $db->plimit($max, 0);
  72      
  73              $result = $db->query($sql);
  74      
  75              if ($result)
  76              {
  77                  $num = $db->num_rows($result);
  78      
  79                  $i = 0;
  80      
  81                  while ($i < $num)
  82                  {
  83                      $objp = $db->fetch_object($result);
  84      
  85                      $this->info_box_contents[$i][0] = array('align' => 'left',
  86                      'logo' => $this->boximg,
  87                      'text' => $objp->title,
  88                      'url' => DOL_URL_ROOT."/boutique/livre/fiche.php?id=".$objp->rowid);
  89      
  90                      $i++;
  91                  }
  92              }
  93              else {
  94                  dolibarr_print_error($db);
  95              }
  96          }
  97          else {
  98              $this->info_box_contents[0][0] = array('align' => 'left',
  99              'text' => $langs->trans("ReadPermissionNotAllowed"));
 100          }
 101  
 102      }
 103  
 104      function showBox()
 105      {
 106          parent::showBox($this->info_box_head, $this->info_box_contents);
 107      }
 108  
 109  }
 110  
 111  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics