From 3e09d3afcfa47d18287e7dfdf5406ddbc379d34c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 12 Mar 2003 19:02:06 +0000 Subject: [PATCH] Nouveaux fichiers --- htdocs/product/album/album.class.php | 321 +++++++++++++++++++ htdocs/product/album/fiche.php | 216 +++++++++++++ htdocs/product/album/index.php | 75 +++++ htdocs/product/album/pre.inc.php | 64 ++++ htdocs/product/categorie/categorie.class.php | 249 ++++++++++++++ htdocs/product/categorie/fiche.php | 193 +++++++++++ htdocs/product/categorie/index.php | 106 ++++++ htdocs/product/categorie/pre.inc.php | 80 +++++ htdocs/product/concert/concert.class.php | 155 +++++++++ htdocs/product/concert/fiche.php | 187 +++++++++++ htdocs/product/concert/fichelieu.php | 155 +++++++++ htdocs/product/concert/index.php | 83 +++++ htdocs/product/concert/lieuconcert.class.php | 155 +++++++++ htdocs/product/concert/pre.inc.php | 67 ++++ htdocs/product/concert/salles.php | 76 +++++ htdocs/product/groupart/fiche.php | 157 +++++++++ htdocs/product/groupart/groupart.class.php | 206 ++++++++++++ htdocs/product/groupart/index.php | 75 +++++ htdocs/product/groupart/pre.inc.php | 59 ++++ htdocs/product/pre.inc.php3 | 18 +- 20 files changed, 2696 insertions(+), 1 deletion(-) create mode 100644 htdocs/product/album/album.class.php create mode 100644 htdocs/product/album/fiche.php create mode 100644 htdocs/product/album/index.php create mode 100644 htdocs/product/album/pre.inc.php create mode 100644 htdocs/product/categorie/categorie.class.php create mode 100644 htdocs/product/categorie/fiche.php create mode 100644 htdocs/product/categorie/index.php create mode 100644 htdocs/product/categorie/pre.inc.php create mode 100644 htdocs/product/concert/concert.class.php create mode 100644 htdocs/product/concert/fiche.php create mode 100644 htdocs/product/concert/fichelieu.php create mode 100644 htdocs/product/concert/index.php create mode 100644 htdocs/product/concert/lieuconcert.class.php create mode 100644 htdocs/product/concert/pre.inc.php create mode 100644 htdocs/product/concert/salles.php create mode 100644 htdocs/product/groupart/fiche.php create mode 100644 htdocs/product/groupart/groupart.class.php create mode 100644 htdocs/product/groupart/index.php create mode 100644 htdocs/product/groupart/pre.inc.php diff --git a/htdocs/product/album/album.class.php b/htdocs/product/album/album.class.php new file mode 100644 index 00000000000..723e088fd1f --- /dev/null +++ b/htdocs/product/album/album.class.php @@ -0,0 +1,321 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Album { + var $db ; + + var $id ; + var $oscid ; + var $ref; + var $annee; + var $titre; + var $description; + var $price ; + var $status ; + + Function Album($DB, $id=0) { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function create($user) { + + if (strlen($this->annee)) + { + $this->annee = 0; + } + + $sql = "insert into ".DB_NAME_OSC.".products (products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_date_added) "; + $sql .= "values ('', '', 'Array', '', null, '', '0', '0', '8', now())"; + + if ($this->db->query($sql) ) + { + $idosc = $this->db->last_insert_id(); + + $sql = "insert into ".DB_NAME_OSC.".products_to_categories (products_id, categories_id) values ($idosc, 0)"; + + if ($this->db->query($sql) ) + { + + $sql = "insert into ".DB_NAME_OSC.".products_description (products_name, products_description, products_url, products_id, language_id) values ('".trim($this->titre)."', '".trim($this->description)."', '', $idosc, '1')"; + + if ($this->db->query($sql) ) + { + + $sql = "INSERT INTO llx_album (osc_id, fk_user_author) VALUES ($idosc, ".$user->id.")"; + + if ($this->db->query($sql) ) + { + $id = $this->db->last_insert_id(); + + if ( $this->update($id, $user) ) + { + return $id; + } + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + + /* + * + * + * + */ + Function linkga($id, $gaid) + { + + $sql = "INSERT INTO llx_album_to_groupart (fk_album, fk_groupart) values ($id, $gaid)"; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + */ + Function liste_groupart() + { + $ga = array(); + + $sql = "SELECT g.rowid, g.nom FROM llx_groupart as g, llx_album_to_groupart as l"; + $sql .= " WHERE g.rowid = l.fk_groupart AND l.fk_album = ".$this->id; + $sql .= " ORDER BY g.nom"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->nom; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + /* + * + * + * + */ + Function updateosc() + { + + $sql = "UPDATE ".DB_NAME_OSC.".products_description "; + + $sql .= " SET products_name = '".$this->titre."'"; + + $desc .= '
Info supplémentaires'; + $ga = array(); + $ga = $this->liste_groupart(); + if (sizeof($ga) == 1) + { + foreach ($ga as $key => $value) + { + $gaid = $key; + } + + + $groupart = new Groupart($this->db); + $result = $groupart->fetch($gaid); + + if ( $result ) + { + + $desc = $groupart->nom."

"; + + $desc .= addslashes($this->description); + + $desc .= "

Autres albums : "; + + $gas = $groupart->liste_albums(); + $i = 0; + $sizegas = sizeof($gas) - 1; + foreach ($gas as $key => $value) + { + if ($key <> $this->id) + { + + $otha = new Album($this->db); + $otha->fetch($key); + + $desc .= ''.$value.""; + $i++; + if ($sizegas > $i) + { + $desc .= ", "; + } + } + } + } + } + + + $sql .= ", products_description = '$desc'"; + + $sql .= " WHERE products_id = " . $this->oscid; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function update($id, $user) + { + + if (strlen($this->annee)==0) + { + $this->annee = 0; + } + + $sql = "UPDATE llx_album "; + $sql .= " SET title = '" . trim($this->titre) ."'"; + $sql .= ", ref = '" . trim(strtoupper($this->ref)) ."'"; + $sql .= ", annee = " . $this->annee ; + $sql .= ",description = '" . trim($this->description) ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT rowid, ref, annee, osc_id, title, description FROM llx_album WHERE rowid = $id"; + + $result = $this->db->query($sql) ; + + if ( $result ) + { + $result = $this->db->fetch_array(); + + $this->id = $result["rowid"]; + $this->ref = $result["ref"]; + $this->annee = $result["annee"]; + $this->titre = $result["title"]; + $this->description = $result["description"]; + $this->oscid = $result["osc_id"]; + + $this->db->free(); + + + $sql = "SELECT products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_date_added"; + $sql .= " FROM ".DB_NAME_OSC.".products WHERE products_id = " . $this->oscid; + + $result = $this->db->query($sql) ; + + if ( $result ) + { + $result = $this->db->fetch_array(); + + $this->status = $result["products_status"]; + $this->price = $result["products_price"]; + + $this->db->free(); + } + else + { + print $this->db->error(); + } + } + else + { + print $this->db->error(); + } + + return $result; + } + + + /* + * + * + */ + Function delete($user) { + + $sql = "DELETE FROM ".DB_NAME_OSC.".products WHERE products_id = $idosc "; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_to_categories WHERE products_id = $idosc"; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_description WHERE products_id = $idosc"; + + $sql = "DELETE FROM llx_album WHERE rowid = $id"; + + + } + + +} +?> diff --git a/htdocs/product/album/fiche.php b/htdocs/product/album/fiche.php new file mode 100644 index 00000000000..9559e9e0c27 --- /dev/null +++ b/htdocs/product/album/fiche.php @@ -0,0 +1,216 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($action == 'add') { + $album = new Album($db); + + $album->titre = $titre; + $album->ref = $ref; + $album->annee = $annee; + $album->description = $desc; + + $id = $album->create($user); +} + +if ($action == 'addga') { + $album = new Album($db); + + $album->linkga($id, $ga); +} + + +if ($action == 'update') { + $album = new Album($db); + + $album->titre = $titre; + $album->ref = $ref; + $album->annee = $annee; + $album->description = $desc; + + $album->update($id, $user); +} + +if ($action == 'updateosc') { + $album = new Album($db); + $result = $album->fetch($id); + + $album->updateosc($user); +} + +/* + * + * + */ +if ($action == 'create') +{ + + print "

\n"; + print ""; + + print '
Nouvel album

'; + + print ''; + print ""; + print ''; + print ''; + print ''; + print ""; + print ''; + print '
Référence
Titre
Prix
Description"; + print '
 
'; + print '
'; + + +} +else +{ + if ($id) + { + + $album = new Album($db); + $result = $album->fetch($id); + + if ( $result ) + { + + $gas = $album->liste_groupart(); + + + print '
Fiche Album : '.$album->titre.'

'; + + print ''; + print ""; + print ''; + print ''; + + print "\n"; + print '"; + print "\n"; + print "\n"; + print ''; + + print '\n"; + + print "
Référence'.$album->ref.'Description
Statut$album->status'.nl2br($album->description)."
Titre$album->titre
Annee$album->annee
Prix'.price($album->price).'
Artiste/Groupe'; + foreach ($gas as $key => $value) + { + print ''.$value."
"; + } + print "
"; + + + if ($action == 'edit') + { + print '
Edition de la fiche Album : '.$album->titre.'

'; + + print "
\n"; + print ""; + + print ''; + print ""; + print ''; + print ""; + + print ''; + print '"; + + print ''; + print ''; + + print ''; + + print ''; + + $htmls = new Form($db); + $ga = new Groupart($db); + + print "\n"; + print ""; + + foreach ($gas as $key => $value) + { + print ''; + print '\n"; + } + + print ""; + print ''; + print ""; + print '
RéférenceDescription
Titre
Année
Prix
 
Artiste/Groupe'.$value."
Artiste/Groupe"; + $htmls->select_array("ga", $ga->liste_array()); + print "
 
'; + + } + + } + else + { + print "Fetch failed"; + } + + + } + else + { + print "Error"; + } +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; + +print ''; + +print ''; + +if ($action == 'create') +{ + print ''; +} +else +{ + print ''; +} +print ''; +print '
-[Update Osc]--[Editer]-

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/album/index.php b/htdocs/product/album/index.php new file mode 100644 index 00000000000..f0a55a17071 --- /dev/null +++ b/htdocs/product/album/index.php @@ -0,0 +1,75 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="lower(a.title)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + + +print_barre_liste("Liste des albums", $page, $PHP_SELF); + +$sql = "SELECT a.rowid, a.title, a.osc_id FROM llx_album as a"; + +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print ''; + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Titre",$PHP_SELF, "a.title"); + print "
rowid\">$objp->titleurl
"; + $db->free(); +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/album/pre.inc.php b/htdocs/product/album/pre.inc.php new file mode 100644 index 00000000000..b69c93fb9ae --- /dev/null +++ b/htdocs/product/album/pre.inc.php @@ -0,0 +1,64 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("../../main.inc.php3"); +require("./album.class.php"); +require("../groupart/groupart.class.php"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("/product/album/", "Albums"); + + $menu->add_submenu("../osc-liste.php", "Osc"); + $menu->add_submenu("../osc-liste.php?reqstock=epuise", "Produits Epuisés"); + + $menu->add_submenu("/product/album/fiche.php?&action=create","Nouvel album"); + + $menu->add("/product/groupart/", "Artistes/Groupes"); + + $menu->add_submenu("/product/groupart/fiche.php?&action=create","Nouvel Artiste/Groupe"); + + $menu->add("/product/concert/", "Concerts"); + + $menu->add_submenu("/product/concert/fiche.php?&action=create","Nouveau concert"); + + $menu->add("../osc-reviews.php", "Critiques"); + + $menu->add_submenu("../osc-productsbyreviews.php", "Meilleurs produits"); + + + left_menu($menu->liste); + /* + * + * + */ + +} +?> diff --git a/htdocs/product/categorie/categorie.class.php b/htdocs/product/categorie/categorie.class.php new file mode 100644 index 00000000000..2daaf0559ab --- /dev/null +++ b/htdocs/product/categorie/categorie.class.php @@ -0,0 +1,249 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Categorie { + var $db ; + + var $id ; + var $oscid ; + var $ref; + var $titre; + var $description; + var $price ; + var $status ; + + Function Categorie($DB, $id=0) { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function create($user) { + + $sql = "INSERT INTO llx_album (osc_id, fk_user_author) VALUES ($idosc, ".$user->id.")"; + + if ($this->db->query($sql) ) + { + $id = $this->db->last_insert_id(); + + if ( $this->update($id, $user) ) + { + return $id; + } + } + else + { + print $this->db->error() . ' in ' . $sql; + } + } + + /* + * + * + * + */ + Function linkga($id, $gaid) + { + + $sql = "INSERT INTO llx_album_to_groupart (fk_album, fk_groupart) values ($id, $gaid)"; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + */ + Function liste_array() + { + $cl = array(); + + $sql = "SELECT c.categories_id, cd.categories_name "; + $sql .= " FROM ".DB_NAME_OSC.".categories as c,".DB_NAME_OSC.".categories_description as cd"; + $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; + $sql .= " AND c.parent_id = 0"; + + if ( $this->db->query($sql) ) + { + $num = $this->db->num_rows(); + $i = 0; + + while ($i < $num) + { + $objp = $this->db->fetch_object( $i); + $var=!$var; + $pc = array(); + $pc = $this->printc($objp->categories_id, 0); + foreach($pc as $key => $value) + { + $cl[$key] = $value; + } + $i++; + } + } + return $cl; + } + /* + */ + Function printc($id, $level) + { + $cr = array(); + $cat = new Categorie($this->db); + $cat->fetch($id); + + for ($i = 0 ; $i < $level ; $i++) + { + $string = "  |--"; + } + + $string .= $cat->name; + + + + $childs = array(); + $childs = $cat->liste_childs_array(); + + if (sizeof($childs)) + { + foreach($childs as $key => $value) + { + $cr[$key] = $value; + $this->printc($key, $level+1); + } + } + + return $cr; + } + /* + * + * + */ + Function liste_childs_array() + { + $ga = array(); + + $sql = "SELECT c.categories_id, cd.categories_name"; + $sql .= " FROM ".DB_NAME_OSC.".categories as c,".DB_NAME_OSC.".categories_description as cd"; + $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; + $sql .= " AND c.parent_id = " . $this->id; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->categories_id] = $obj->categories_name; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + /* + * + * + * + */ + /* + * + * + * + */ + Function update($id, $user) + { + + $sql = "UPDATE llx_album "; + $sql .= " SET title = '" . trim($this->titre) ."'"; + $sql .= ",description = '" . trim($this->description) ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT c.categories_id, cd.categories_name"; + $sql .= " FROM ".DB_NAME_OSC.".categories as c,".DB_NAME_OSC.".categories_description as cd"; + $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; + $sql .= " AND c.categories_id = $id"; + $result = $this->db->query($sql) ; + + if ( $result ) { + $result = $this->db->fetch_array(); + + $this->id = $result["categories_id"]; + $this->name = $result["categories_name"]; + $this->titre = $result["title"]; + $this->description = $result["description"]; + $this->oscid = $result["osc_id"]; + } + $this->db->free(); + + return $result; + } + + + /* + * + * + */ + Function delete($user) { + + $sql = "DELETE FROM ".DB_NAME_OSC.".products WHERE products_id = $idosc "; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_to_categories WHERE products_id = $idosc"; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_description WHERE products_id = $idosc"; + + $sql = "DELETE FROM llx_album WHERE rowid = $id"; + + + } + + +} +?> diff --git a/htdocs/product/categorie/fiche.php b/htdocs/product/categorie/fiche.php new file mode 100644 index 00000000000..b9740b79e5d --- /dev/null +++ b/htdocs/product/categorie/fiche.php @@ -0,0 +1,193 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($action == 'add') { + $album = new Album($db); + + $album->titre = $titre; + $album->description = $desc; + + $id = $album->create($user); +} + +if ($action == 'addga') { + $album = new Album($db); + + $album->linkga($id, $ga); +} + + +if ($action == 'update') { + $album = new Album($db); + + $album->titre = $titre; + $album->description = $desc; + + $album->update($id, $user); +} + +if ($action == 'updateosc') { + $album = new Album($db); + $result = $album->fetch($id); + + $album->updateosc($user); +} + +/* + * + * + */ +if ($action == 'create') +{ + + print "

\n"; + print ""; + + print '
Nouvel album

'; + + print ''; + print ""; + print ''; + print ''; + print ''; + print ""; + print ''; + print '
Référence
Titre
Prix
Description"; + print '
 
'; + print '
'; + + +} +else +{ + if ($id) + { + + $album = new Album($db); + $result = $album->fetch($id); + + if ( $result ) + { + print '
Fiche Album : '.$album->titre.'

'; + + print ''; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ''; + print '"; + + $gas = $album->liste_groupart(); + print '\n"; + print "
Référence$album->refStatut$album->status
Titre$album->titrePrix'.price($album->price).'
Description'.nl2br($album->description)."Artiste/Groupe
    '; + foreach ($gas as $key => $value) + { + print '
  • '.$value."
  • "; + } + print "
"; + } + + if ($action == 'edit') + { + print '
Edition de la fiche Album : '.$album->titre.'

'; + + print "
\n"; + print ""; + + print ''; + print ""; + print ''; + print ''; + print ''; + print ""; + print ''; + + print ''; + + $htmls = new Form($db); + $ga = new Groupart($db); + + print "\n"; + print ""; + + foreach ($gas as $key => $value) + { + print ''; + print '\n"; + } + + print ""; + print ''; + print ""; + print '
Référence
Libellé
Prix
Description"; + print '
 
Artiste/Groupe'.$value."
Artiste/Groupe"; + $htmls->select_array("ga", $ga->liste_array()); + print "
 
'; + + } + } + else + { + print "Error"; + } +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; + +print ''; + +print ''; + +if ($action == 'create') +{ + print ''; +} +else +{ + print ''; +} +print ''; +print '
-[Update Osc]--[Editer]-

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/categorie/index.php b/htdocs/product/categorie/index.php new file mode 100644 index 00000000000..fa9726739c8 --- /dev/null +++ b/htdocs/product/categorie/index.php @@ -0,0 +1,106 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="lower(cd.categories_name)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des catégories", $page, $PHP_SELF); + +$sql = "SELECT c.categories_id, cd.categories_name "; +$sql .= " FROM ".DB_NAME_OSC.".categories as c,".DB_NAME_OSC.".categories_description as cd"; +$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; +$sql .= " AND c.parent_id = 0"; +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) +{ + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + + printc($objp->categories_id,$db, 0); + + $i++; + } + print "
"; + print_liste_field_titre("Titre",$PHP_SELF, "a.title"); + print "
"; + $db->free(); +} +else +{ + print $db->error(); +} + +Function printc($id, $db, $level) +{ + + $cat = new Categorie($db); + $cat->fetch($id); + + print ""; + + for ($i = 0 ; $i < $level ; $i++) + { + print "  |--"; + } + + print "rowid\">".$cat->name."\n"; + print "\n"; + + $childs = array(); + $childs = $cat->liste_childs_array(); + if (sizeof($childs)) + { + foreach($childs as $key => $value) + { + printc($key,$db, $level+1); + } + } + +} +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/categorie/pre.inc.php b/htdocs/product/categorie/pre.inc.php new file mode 100644 index 00000000000..2c16ba50455 --- /dev/null +++ b/htdocs/product/categorie/pre.inc.php @@ -0,0 +1,80 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("../../main.inc.php3"); +require("../groupart/groupart.class.php"); +require("../categorie/categorie.class.php"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + if ($conf->boutique->livre->enabled) + { + $menu->add("/boutique/livre/", "Livres"); + + $menu->add_submenu("/boutique/livre/fiche.php?&action=create","Nouvel ouvrage"); + + $menu->add("/boutique/editeur/", "Editeurs"); + + $menu->add_submenu("/boutique/editeur/fiche.php?&action=create","Nouvel éditeur"); + + } + + $menu->add("/product/categorie/", "Catégories"); + + if ($conf->boutique->album->enabled) + { + $menu->add("/product/album/", "Albums"); + + $menu->add_submenu("../osc-liste.php", "Osc"); + $menu->add_submenu("../osc-liste.php?reqstock=epuise", "Produits Epuisés"); + + $menu->add_submenu("/product/album/fiche.php?&action=create","Nouvel album"); + + $menu->add("/product/groupart/", "Artistes/Groupes"); + + $menu->add_submenu("/product/groupart/fiche.php?&action=create","Nouvel Artiste/Groupe"); + + $menu->add("/product/concert/", "Concerts"); + + $menu->add_submenu("/product/concert/fiche.php?&action=create","Nouveau concert"); + + $menu->add("../osc-reviews.php", "Critiques"); + + $menu->add_submenu("../osc-productsbyreviews.php", "Meilleurs produits"); + } + + left_menu($menu->liste); + /* + * + * + */ + +} +?> diff --git a/htdocs/product/concert/concert.class.php b/htdocs/product/concert/concert.class.php new file mode 100644 index 00000000000..d4b71f79c6e --- /dev/null +++ b/htdocs/product/concert/concert.class.php @@ -0,0 +1,155 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Concert { + var $db ; + + var $id ; + var $date ; + var $groupartid; + var $lieuid; + var $description; + + Function Concert($DB, $id=0) { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function create($user) + { + + $sql = "INSERT INTO llx_concert (fk_user_author) VALUES (".$user->id.")"; + + if ($this->db->query($sql) ) + { + $id = $this->db->last_insert_id(); + + if ( $this->update($id, $user) ) + { + return $id; + } + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + + /* + * + * + * + */ + Function update($id, $user) + { + + $sql = "UPDATE llx_concert "; + $sql .= " SET date_concert = '" . $this->date ."'"; + $sql .= ", fk_groupart = '" . $this->groupartid ."'"; + $sql .= ", fk_lieu_concert = '" . $this->lieuid ."'"; + $sql .= ",description = '" . trim($this->description) ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT rowid,".$this->db->pdate("date_concert")." as dc, description, fk_groupart, fk_lieu_concert"; + $sql .= " FROM llx_concert WHERE rowid = $id"; + + $result = $this->db->query($sql) ; + + if ( $result ) { + $result = $this->db->fetch_array(); + + $this->id = $result["rowid"]; + $this->date = $result["dc"]; + $this->titre = $result["title"]; + $this->description = $result["description"]; + $this->groupartid = $result["fk_groupart"]; + $this->lieuid = $result["fk_lieu_concert"]; + } + $this->db->free(); + + return $result; + } + + + /* + * + * + */ + + + /* + * + * + */ + Function liste_groupart() + { + $ga = array(); + + $sql = "SELECT g.rowid, g.nom FROM llx_groupart as g, llx_album_to_groupart as l"; + $sql .= " WHERE g.rowid = l.fk_groupart AND l.fk_album = ".$this->id; + $sql .= " ORDER BY g.nom"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->nom; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + + +} +?> diff --git a/htdocs/product/concert/fiche.php b/htdocs/product/concert/fiche.php new file mode 100644 index 00000000000..26869b4c2bb --- /dev/null +++ b/htdocs/product/concert/fiche.php @@ -0,0 +1,187 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($action == 'add') { + $concert = new Concert($db); + + $concert->groupartid = $HTTP_POST_VARS["ga"]; + $concert->lieuid = $HTTP_POST_VARS["lc"]; + $concert->date = $db->idate(mktime(12, 0 , 0, $remonth, $reday, $reyear)); + $concert->description = $desc; + + $id = $concert->create($user); +} + +if ($action == 'update') { + $concert = new Concert($db); + + $concert->groupartid = $HTTP_POST_VARS["ga"]; + $concert->lieuid = $HTTP_POST_VARS["lc"]; + $concert->date = $db->idate(mktime(12, 0 , 0, $remonth, $reday, $reyear)); + $concert->description = $desc; + + $concert->update($id, $user); +} + +if ($action == 'updateosc') { + $concert = new Concert($db); + $result = $concert->fetch($id); + + $concert->updateosc($user); +} + +/* + * + * + */ +if ($action == 'create') +{ + + print "

\n"; + print ""; + + print '
Nouveau concert

'; + + $htmls = new Form($db); + + print ''; + + $ga = new Groupart($db); + + print ""; + + print "'; + + $lc = new LieuConcert($db); + + print "'; + + print ''; + print '
Date"; + print_date_select(); + print "
Lieu"; + $htmls->select_array("ga", $ga->liste_array()); + print '
Lieu"; + $htmls->select_array("lc", $lc->liste()); + print 'Nouveau lieu
 
'; + print '
'; + + +} +else +{ + if ($id) + { + + $concert = new Concert($db); + $result = $concert->fetch($id); + + $groupart = new Groupart($db); + $result = $groupart->fetch($concert->groupartid); + + $lieuconcert = new LieuConcert($db); + $result = $lieuconcert->fetch($concert->lieuid); + + if ( $result ) + { + print '
Fiche Concert : '.$concert->titre.'

'; + + print ''; + print ""; + print "\n"; + + print '"; + + print '"; + + print '"; + + + print "
Date".strftime("%A %d %B %Y",$concert->date)."
Artiste/Groupe'.$groupart->nom_url."
Lieu'.$lieuconcert->nom_url."
Description'.nl2br($concert->description)."
"; + } + + if ($action == 'edit') + { + print '
Edition de la fiche Concert : '.$concert->titre.'

'; + + print "
\n"; + print ""; + + print ''; + print ""; + print ''; + print ''; + print ''; + print ""; + + + + print ''; + print '
Référence
Libellé
Prix
Description"; + print '
'; + + } + } + else + { + print "Error"; + } +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; + +print ''; + +print ''; + +if ($action == 'create') +{ + print ''; +} +else +{ + print ''; +} +print ''; +print '
-[Update Osc]--[Editer]-

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/concert/fichelieu.php b/htdocs/product/concert/fichelieu.php new file mode 100644 index 00000000000..1918e3e4388 --- /dev/null +++ b/htdocs/product/concert/fichelieu.php @@ -0,0 +1,155 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($action == 'add') { + $lieuconcert = new LieuConcert($db); + + $lieuconcert->nom = $nom; + $lieuconcert->ville = $ville; + $lieuconcert->description = $desc; + + $id = $lieuconcert->create($user); +} + +if ($action == 'update') { + $lieuconcert = new LieuConcert($db); + + $lieuconcert->nom = $nom; + $lieuconcert->ville = $ville; + $lieuconcert->description = $desc; + + $lieuconcert->update($id, $user); +} + +if ($action == 'updateosc') { + $lieuconcert = new LieuConcert($db); + $result = $lieuconcert->fetch($id); + + $lieuconcert->updateosc($user); +} + +/* + * + * + */ +if ($action == 'create') +{ + + print "
\n"; + print ""; + + print '
Nouveau lieu de concert

'; + + print ''; + print ""; + print ''; + print ''; + print ""; + print ''; + print '
Nom
Ville
Description"; + print '
 
'; + print '
'; + + +} +else +{ + if ($id) + { + + $lieuconcert = new LieuConcert($db); + $result = $lieuconcert->fetch($id); + + if ( $result ) + { + print '
Fiche lieu de concert : '.$lieuconcert->nom.'

'; + + print ''; + print "\n"; + print "\n"; + print '"; + + print "
Nom$lieuconcert->nom
Ville$lieuconcert->ville
Description'; + print nl2br($lieuconcert->description)."
"; + } + + if ($action == 'edit') + { + print '
Edition de la fiche lieu de concert : '.$lieuconcert->nom.'

'; + + print "
\n"; + print ""; + + print ''; + print ''; + print ''; + print ""; + print ''; + print ''; + print '
Nom
Ville
Description"; + print '
 
'; + + } + } + else + { + print "Error"; + } +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; +print ''; +print ''; + +if ($action == 'create') +{ + print ''; +} +else +{ + print ''; +} +print ''; +print '
----[Editer]-

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/concert/index.php b/htdocs/product/concert/index.php new file mode 100644 index 00000000000..343c209a098 --- /dev/null +++ b/htdocs/product/concert/index.php @@ -0,0 +1,83 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="c.date_concert"; +} +if ($sortorder == "") { + $sortorder="DESC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des concerts", $page, $PHP_SELF); + +$sql = "SELECT c.rowid, c.date_concert as dc, ga.nom, lc.nom as lieu, lc.ville"; +$sql .= " FROM llx_concert as c, llx_groupart as ga, llx_lieu_concert as lc"; +$sql .= " WHERE c.fk_groupart = ga.rowid AND c.fk_lieu_concert = lc.rowid"; +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + + print "\n"; + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print ''; + print ''; + print ''; + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Titre",$PHP_SELF, "a.title"); + print ""; + print_liste_field_titre("Artiste/Groupe",$PHP_SELF, "ga.nom"); + print ""; + print_liste_field_titre("Salle",$PHP_SELF, "lc.nom"); + print ""; + print_liste_field_titre("Ville",$PHP_SELF, "lc.ville"); + print "
rowid\">$objp->dc'.$objp->nom.''.$objp->lieu.''.$objp->ville.'
"; + $db->free(); +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/concert/lieuconcert.class.php b/htdocs/product/concert/lieuconcert.class.php new file mode 100644 index 00000000000..f3b7b6836f0 --- /dev/null +++ b/htdocs/product/concert/lieuconcert.class.php @@ -0,0 +1,155 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class LieuConcert { + var $db ; + var $id ; + var $nom; + var $ville; + var $description; + + Function LieuConcert($DB, $id=0) + { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function create($user) + { + + $sql = "INSERT INTO llx_lieu_concert (fk_user_author) VALUES (".$user->id.")"; + + if ($this->db->query($sql) ) + { + $id = $this->db->last_insert_id(); + + if ( $this->update($id, $user) ) + { + return $id; + } + } + else + { + print $this->db->error() . ' in ' . $sql; + } + + } + + /* + * + * + * + */ + Function update($id, $user) + { + + $sql = "UPDATE llx_lieu_concert "; + $sql .= " SET nom = '" . trim($this->nom) ."'"; + $sql .= ",ville = '" . trim($this->ville) ."'"; + $sql .= ",description = '" . trim($this->description) ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT rowid, nom, ville, description FROM llx_lieu_concert WHERE rowid = $id"; + + $result = $this->db->query($sql) ; + + if ( $result ) { + $result = $this->db->fetch_array(); + + $this->id = $result["rowid"]; + $this->nom = $result["nom"]; + $this->ville = $result["ville"]; + $this->description = $result["description"]; + + $this->nom_url = ''.$result["nom"].''; + } + $this->db->free(); + + return $result; + } + + + /* + * + * + */ + Function delete($user) { + + + + } + + + /* + * + * + */ + Function liste() + { + $ga = array(); + + $sql = "SELECT rowid, nom, ville, description FROM llx_lieu_concert"; + $sql .= " ORDER BY ville, nom"; + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->ville . " - " .$obj->nom; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + + +} +?> diff --git a/htdocs/product/concert/pre.inc.php b/htdocs/product/concert/pre.inc.php new file mode 100644 index 00000000000..69b6320844e --- /dev/null +++ b/htdocs/product/concert/pre.inc.php @@ -0,0 +1,67 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("../../main.inc.php3"); +require("./concert.class.php"); +require("./lieuconcert.class.php"); +require("../groupart/groupart.class.php"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("/product/album/", "Albums"); + + $menu->add_submenu("/product/album/fiche.php?&action=create","Nouvel album"); + + $menu->add("/product/groupart/", "Artistes/Groupes"); + + $menu->add_submenu("/product/groupart/fiche.php?&action=create","Nouvel Artiste/Groupe"); + + + $menu->add("/product/concert/", "Concerts"); + + $menu->add_submenu("/product/concert/fiche.php?&action=create","Nouveau concert"); + + $menu->add("/product/concert/salles.php", "Salles"); + + $menu->add_submenu("/product/concert/fichelieu.php?&action=create","Nouveau lieu de concert"); + + + $menu->add("../osc-reviews.php", "Critiques"); + + $menu->add_submenu("../osc-productsbyreviews.php", "Meilleurs produits"); + + left_menu($menu->liste); + /* + * + * + */ + +} +?> diff --git a/htdocs/product/concert/salles.php b/htdocs/product/concert/salles.php new file mode 100644 index 00000000000..63a523fc5ee --- /dev/null +++ b/htdocs/product/concert/salles.php @@ -0,0 +1,76 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="lower(lc.nom)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des concerts", $page, $PHP_SELF); + +$sql = "SELECT lc.rowid, lc.nom, lc.ville FROM llx_lieu_concert as lc"; + +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + + print "\n"; + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Nom",$PHP_SELF, "lc.nom"); + print ""; + print_liste_field_titre("Ville",$PHP_SELF, "lc.ville"); + print "
rowid\">$objp->nom$objp->ville
"; + $db->free(); +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/groupart/fiche.php b/htdocs/product/groupart/fiche.php new file mode 100644 index 00000000000..d01d337e6f2 --- /dev/null +++ b/htdocs/product/groupart/fiche.php @@ -0,0 +1,157 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($action == 'add') { + $groupart = new Groupart($db); + + $groupart->nom = $nom; + + $id = $groupart->create($user); +} + +if ($action == 'update') { + $groupart = new Groupart($db); + + $groupart->nom = $nom; + + $groupart->update($id, $user); +} + +if ($action == 'updateosc') { + $groupart = new Groupart($db); + $result = $groupart->fetch($id); + + $groupart->updateosc($user); +} + +/* + * + * + */ +if ($action == 'create') +{ + + print "

\n"; + print ""; + + print '
Nouvel Artiste/Groupe

'; + + print ''; + print ""; + print ''; + print ''; + print ""; + print ''; + print '
Nom
Artiste/Groupe
Description"; + print '
 
'; + print '
'; + + +} +else +{ + if ($id) + { + + $groupart = new Groupart($db); + $result = $groupart->fetch($id); + + if ( $result ) + { + print '
Fiche Artiste/Groupe

'; + + print ''; + print ""; + print "\n"; + print ""; + + $gas = $groupart->liste_albums(); + print '\n"; + print "
Nom$groupart->nom
Description".nl2br($groupart->description)."
Album(s)
    '; + foreach ($gas as $key => $value) + { + print '
  • '.$value."
  • "; + } + print "
"; + } + + if ($action == 'edit') + { + print '
Edition de la fiche produit : '.$groupart->ref.'

'; + + print "
\n"; + print ""; + + print ''; + print ''; + + print ""; + print ''; + print '
Nom
Description"; + print '
 
'; + print '
'; + } + } + else + { + print "Error"; + } +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; +print ''; +print ''; + +if ($action == 'create') +{ + print ''; +} +else +{ + print ''; +} +print ''; +print '
-[Update Osc]--[Editer]-

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/groupart/groupart.class.php b/htdocs/product/groupart/groupart.class.php new file mode 100644 index 00000000000..51ed216dd40 --- /dev/null +++ b/htdocs/product/groupart/groupart.class.php @@ -0,0 +1,206 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Groupart { + var $db ; + + var $id ; + var $nom ; + + Function Groupart($DB, $id=0) { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function create($user) { + + $sql = "INSERT INTO llx_groupart (fk_user_author) VALUES (".$user->id.")"; + + if ($this->db->query($sql) ) + { + $id = $this->db->last_insert_id(); + + if ( $this->update($id, $user) ) + { + return $id; + } + } + else + { + print $this->db->error() . ' in ' . $sql; + } + } + + /* + * + * + * + */ + Function update($id, $user) + { + + $sql = "UPDATE llx_groupart "; + $sql .= " SET nom = '" . trim($this->nom) ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) { + return 1; + } else { + print $this->db->error() . ' in ' . $sql; + } + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT rowid, nom FROM llx_groupart WHERE rowid = $id"; + + $result = $this->db->query($sql) ; + + if ( $result ) { + $result = $this->db->fetch_array(); + + $this->id = $result["rowid"]; + $this->nom = $result["nom"]; + + $this->nom_url = ''.$result["nom"].''; + + } + $this->db->free(); + + return $result; + } + /* + * + * + */ + Function liste_albums () + { + $ga = array(); + + $sql = "SELECT a.rowid, a.title FROM llx_album as a, llx_album_to_groupart as l"; + $sql .= " WHERE a.rowid = l.fk_album AND l.fk_groupart = ".$this->id; + $sql .= " ORDER BY a.title"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->title; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + /* + * + * + */ + Function updateosc() + { + $albs = array(); + $albs = $this->liste_albums(); + + foreach($albs as $key => $value) + { + $alb = new Album($this->db); + $alb->fetch($key); + $alb->updateosc(); + } + } + /* + * + * + */ + Function liste_array () + { + $ga = array(); + + $sql = "SELECT rowid, nom FROM llx_groupart ORDER BY nom"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->nom; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + + } + + + + + /* + * + * + */ + Function delete($user) { + + $sql = "DELETE FROM ".DB_NAME_OSC.".products WHERE products_id = $idosc "; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_to_categories WHERE products_id = $idosc"; + + $sql = "DELETE FROM ".DB_NAME_OSC.".products_description WHERE products_id = $idosc"; + + $sql = "DELETE FROM llx_album WHERE rowid = $id"; + + + } + + +} +?> diff --git a/htdocs/product/groupart/index.php b/htdocs/product/groupart/index.php new file mode 100644 index 00000000000..2f0863302eb --- /dev/null +++ b/htdocs/product/groupart/index.php @@ -0,0 +1,75 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="lower(g.nom)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + + +print_barre_liste("Liste des Artistes/Groupes", $page, $PHP_SELF); + +$sql = "SELECT g.rowid, g.nom, groupart FROM llx_groupart as g"; + +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Réf",$PHP_SELF, "p.ref"); + print "
rowid\">$objp->nom$objp->groupart
"; + $db->free(); +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/groupart/pre.inc.php b/htdocs/product/groupart/pre.inc.php new file mode 100644 index 00000000000..d2cba065442 --- /dev/null +++ b/htdocs/product/groupart/pre.inc.php @@ -0,0 +1,59 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("../../main.inc.php3"); +require("./groupart.class.php"); +require("../album/album.class.php"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("/product/album/", "Albums"); + + $menu->add_submenu("../album/fiche.php?&action=create","Nouvel album"); + + $menu->add("/product/groupart/", "Artistes/Groupes"); + + $menu->add_submenu("/product/groupart/fiche.php?&action=create","Nouvel Artiste/Groupe"); + + $menu->add("/product/concert/", "Concerts"); + + $menu->add_submenu("/product/concert/fiche.php?&action=create","Nouveau concert"); + + $menu->add("../osc-reviews.php", "Critiques"); + + + left_menu($menu->liste); + /* + * + * + */ + +} +?> diff --git a/htdocs/product/pre.inc.php3 b/htdocs/product/pre.inc.php3 index c53743a7e7f..c3a3e3c2504 100644 --- a/htdocs/product/pre.inc.php3 +++ b/htdocs/product/pre.inc.php3 @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2003 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +33,22 @@ function llxHeader($head = "", $urlp = "") { $menu = new Menu(); $menu->add("/product/index.php3", "Produits"); + $menu->add_submenu("fiche.php3?&action=create","Nouveau produit"); + + $menu->add_submenu("osc-liste.php", "Osc"); + $menu->add_submenu("osc-liste.php?reqstock=epuise", "Produits Epuisés"); + + + $menu->add("osc-reviews.php", "Critiques"); + + $menu->add_submenu("osc-productsbyreviews.php", "Meilleurs produits"); + + $menu->add("/product/album/", "Albums"); + $menu->add("/product/groupart/", "Groupes/Artistes"); + + $menu->add("/product/categorie/", "Catégories"); + $menu->add("/service/index.php3", "Services"); $menu->add("/comm/clients.php3", "Clients"); @@ -43,6 +58,7 @@ function llxHeader($head = "", $urlp = "") { $menu->add_submenu("/soc.php3?&action=create","Nouvelle sociétée"); $menu->add_submenu("contact.php3","Contacts"); + left_menu($menu->liste); /* *