[ 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/product/concert/ -> lieuconcert.class.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2003 Éric Seigne <erics@rycks.com>
   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: lieuconcert.class.php,v 1.8 2005/03/18 23:56:44 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/concert/lieuconcert.class.php,v $
  21   *
  22   */
  23  
  24  class LieuConcert {
  25    var $db ;
  26    var $id ;
  27    var $nom;
  28    var $ville;
  29    var $description;
  30  
  31    function LieuConcert($DB, $id=0)
  32    {
  33      $this->db = $DB;
  34      $this->id   = $id ;
  35    }  
  36    /*
  37     *
  38     *
  39     *
  40     */
  41    function create($user) 
  42    {
  43      
  44      $sql = "INSERT INTO ".MAIN_DB_PREFIX."lieu_concert (fk_user_author) VALUES (".$user->id.")";
  45          
  46      if ($this->db->query($sql) )
  47        {
  48      $id = $this->db->last_insert_id(MAIN_DB_PREFIX."lieu_concert");
  49      
  50      if ( $this->update($id, $user) )
  51        {
  52          return $id;
  53        }
  54        }
  55      else
  56        {
  57      print $this->db->error() . ' in ' . $sql;
  58        }
  59      
  60    }
  61  
  62    /*
  63     *
  64     *
  65     *
  66     */
  67    function update($id, $user)
  68    {
  69  
  70      $sql = "UPDATE ".MAIN_DB_PREFIX."lieu_concert ";
  71      $sql .= " SET nom = '" . trim($this->nom) ."'";
  72      $sql .= ",ville = '" . trim($this->ville) ."'";
  73      $sql .= ",description = '" . trim($this->description) ."'";
  74  
  75      $sql .= " WHERE rowid = " . $id;
  76  
  77      if ( $this->db->query($sql) ) {
  78        return 1;
  79      } else {
  80        print $this->db->error() . ' in ' . $sql;
  81      }
  82    }
  83    /*
  84     *
  85     *
  86     *
  87     */
  88    function fetch ($id) {
  89      
  90      $sql = "SELECT rowid, nom, ville, description FROM ".MAIN_DB_PREFIX."lieu_concert WHERE rowid = $id";
  91  
  92      $result = $this->db->query($sql) ;
  93  
  94      if ( $result ) {
  95        $result = $this->db->fetch_array();
  96  
  97        $this->id          = $result["rowid"];
  98        $this->nom         = $result["nom"];
  99        $this->ville       = $result["ville"];
 100        $this->description = $result["description"];
 101  
 102        $this->nom_url     = '<a href="'.DOL_URL_ROOT.'/product/concert/fichelieu.php?id='.$result["rowid"].'">'.$result["nom"].'</a>';
 103      }
 104      $this->db->free();
 105  
 106      return $result;
 107    }
 108  
 109  
 110    /*
 111     *
 112     *
 113     */
 114    function delete($user) {
 115  
 116          
 117      
 118    }
 119  
 120  
 121    /*
 122     *
 123     *
 124     */
 125    function liste()
 126    {
 127      $ga = array();
 128  
 129      $sql = "SELECT rowid, nom, ville, description FROM ".MAIN_DB_PREFIX."lieu_concert";
 130      $sql .= " ORDER BY ville, nom"; 
 131      
 132      $result=$this->db->query($sql);
 133      if ($result)
 134        {
 135      $nump = $this->db->num_rows($result);
 136      
 137      if ($nump)
 138        {
 139          $i = 0;
 140          while ($i < $nump)
 141            {
 142          $obj = $this->db->fetch_object($result);
 143          
 144          $ga[$obj->rowid] = $obj->ville . " - " .$obj->nom;
 145          $i++;
 146            }
 147        }
 148      return $ga;
 149        }
 150      else
 151        {
 152      print $this->db->error();
 153      return -1;
 154        }    
 155    }
 156  
 157  
 158  }
 159  ?>


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