[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: concert.class.php,v 1.6 2005/03/18 23:56:44 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/concert/concert.class.php,v $ 20 * 21 */ 22 23 class Concert { 24 var $db ; 25 26 var $id ; 27 var $date ; 28 var $groupartid; 29 var $lieuid; 30 var $description; 31 32 function Concert($DB, $id=0) { 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."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."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."concert "; 71 $sql .= " SET date_concert = '" . $this->date ."'"; 72 $sql .= ", fk_groupart = '" . $this->groupartid ."'"; 73 $sql .= ", fk_lieu_concert = '" . $this->lieuid ."'"; 74 $sql .= ",description = '" . trim($this->description) ."'"; 75 76 $sql .= " WHERE rowid = " . $id; 77 78 if ( $this->db->query($sql) ) { 79 return 1; 80 } else { 81 print $this->db->error() . ' in ' . $sql; 82 } 83 } 84 /* 85 * 86 * 87 * 88 */ 89 function fetch ($id) { 90 91 $sql = "SELECT rowid,".$this->db->pdate("date_concert")." as dc, description, fk_groupart, fk_lieu_concert"; 92 $sql .= " FROM ".MAIN_DB_PREFIX."concert WHERE rowid = $id"; 93 94 $result = $this->db->query($sql) ; 95 96 if ( $result ) { 97 $result = $this->db->fetch_array($result); 98 99 $this->id = $result["rowid"]; 100 $this->date = $result["dc"]; 101 $this->titre = $result["title"]; 102 $this->description = $result["description"]; 103 $this->groupartid = $result["fk_groupart"]; 104 $this->lieuid = $result["fk_lieu_concert"]; 105 } 106 $this->db->free($result); 107 108 return $this->id; 109 } 110 111 112 /* 113 * 114 * 115 */ 116 function liste_groupart() 117 { 118 $ga = array(); 119 120 $sql = "SELECT g.rowid, g.nom FROM ".MAIN_DB_PREFIX."groupart as g, ".MAIN_DB_PREFIX."album_to_groupart as l"; 121 $sql .= " WHERE g.rowid = l.fk_groupart AND l.fk_album = ".$this->id; 122 $sql .= " ORDER BY g.nom"; 123 124 $result=$this->db->query($sql); 125 if ($result) 126 { 127 $nump = $this->db->num_rows($result); 128 129 if ($nump) 130 { 131 $i = 0; 132 while ($i < $nump) 133 { 134 $obj = $this->db->fetch_object($result); 135 136 $ga[$obj->rowid] = $obj->nom; 137 $i++; 138 } 139 } 140 return $ga; 141 } 142 else 143 { 144 print $this->db->error(); 145 return -1; 146 } 147 } 148 149 150 } 151 ?>
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 |
![]() |