[ 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/boutique/notification/ -> notification.class.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: notification.class.php,v 1.7 2005/07/09 14:34:44 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/boutique/notification/notification.class.php,v $
  20   *
  21   */
  22  
  23  class Editeur {
  24    var $db ;
  25  
  26    var $id ;
  27    var $nom;
  28  
  29    function Editeur($DB, $id=0) {
  30      $this->db = $DB;
  31      $this->id = $id ;
  32    }  
  33    /*
  34     *
  35     *
  36     *
  37     */
  38    function create($user) {
  39  
  40      $sql = "INSERT INTO ".MAIN_DB_PREFIX."editeur (fk_user_author) VALUES (".$user->id.")";
  41      
  42      if ($this->db->query($sql) )
  43        {
  44      $id = $this->db->last_insert_id(MAIN_DB_PREFIX."editeur");
  45      
  46      if ( $this->update($id, $user) )
  47        {
  48          return $id;
  49        }
  50        }
  51      
  52    }
  53  
  54    /*
  55     *
  56     *
  57     */
  58    function liste_array ()
  59    {
  60      $ga = array();
  61  
  62      $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."editeur ORDER BY nom";
  63  
  64      if ($this->db->query($sql) )
  65        {
  66      $nump = $this->db->num_rows();
  67      
  68      if ($nump)
  69        {
  70          $i = 0;
  71          while ($i < $nump)
  72            {
  73          $obj = $this->db->fetch_object();
  74          
  75          $ga[$obj->rowid] = $obj->nom;
  76          $i++;
  77            }
  78        }
  79      return $ga;
  80        }
  81      else
  82        {
  83      print $this->db->error();
  84        }
  85      
  86    }
  87    /*
  88     *
  89     *
  90     *
  91     */
  92    function update($id, $user)
  93    {
  94  
  95      $sql = "UPDATE ".MAIN_DB_PREFIX."editeur ";
  96      $sql .= " SET nom = '" . trim($this->nom) ."'";
  97  
  98      $sql .= " WHERE rowid = " . $id;
  99  
 100      if ( $this->db->query($sql) ) {
 101        return 1;
 102      } else {
 103        print $this->db->error() . ' in ' . $sql;
 104      }
 105    }
 106    /*
 107     *
 108     *
 109     *
 110     */
 111    function fetch ($id) {
 112      
 113      $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."editeur WHERE rowid = $id";
 114  
 115      $result = $this->db->query($sql) ;
 116  
 117      if ( $result )
 118        {
 119      $result = $this->db->fetch_array();
 120  
 121      $this->id      = $result["rowid"];
 122      $this->nom     = stripslashes($result["nom"]);
 123      
 124      $this->db->free();
 125        }
 126      else
 127        {
 128      print $this->db->error();
 129        }
 130      
 131      return $result;
 132    }
 133  
 134  
 135    /*
 136     *
 137     *
 138     */
 139    function delete($user) {
 140  
 141      $sql = "DELETE FROM ".OSC_DB_NAME.".products WHERE products_id = $idosc ";
 142  
 143      $sql = "DELETE FROM ".OSC_DB_NAME.".products_to_categories WHERE products_id = $idosc";
 144  
 145      $sql = "DELETE FROM ".OSC_DB_NAME.".products_description WHERE products_id = $idosc";
 146            
 147      $sql = "DELETE FROM ".MAIN_DB_PREFIX."livre WHERE rowid = $id";
 148          
 149      
 150    }
 151  
 152  
 153  }
 154  ?>


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