Nouveaux fichiers

This commit is contained in:
Rodolphe Quiedeville 2003-03-12 19:02:06 +00:00
parent f3cfda33cd
commit 3e09d3afcf
20 changed files with 2696 additions and 1 deletions

View File

@ -0,0 +1,321 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 .= '<br>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."<p>";
$desc .= addslashes($this->description);
$desc .= "<p><b>Autres albums</b> : ";
$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 .= '<a href="'.OSC_CATALOG_URL.'product_info.php?products_id='.$otha->oscid.'">'.$value."</a>";
$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";
}
}
?>

View File

@ -0,0 +1,216 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<div class="titre">Nouvel album</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Référence</td><td><input name="ref" size="20" value=""></td></tr>';
print '<td>Titre</td><td><input name="titre" size="40" value=""></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value=""></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($id)
{
$album = new Album($db);
$result = $album->fetch($id);
if ( $result )
{
$gas = $album->liste_groupart();
print '<div class="titre">Fiche Album : '.$album->titre.'</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Référence</td><td width="30%">'.$album->ref.'</td>';
print '<td width="50%" valign="top">Description</td></tr>';
print "<tr><td>Statut</td><td>$album->status</td>\n";
print '<td rowspan="6" valign="top">'.nl2br($album->description)."</td>";
print "<tr><td>Titre</td><td>$album->titre</td></tr>\n";
print "<tr><td>Annee</td><td>$album->annee</td></tr>\n";
print '<tr><td>Prix</td><TD>'.price($album->price).'</td></tr>';
print '<td valign="top">Artiste/Groupe</td><td>';
foreach ($gas as $key => $value)
{
print '<a href="../groupart/fiche.php?id='.$key.'">'.$value."</a><br>";
}
print "</td></tr>\n";
print "</table>";
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche Album : '.$album->titre.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Référence</td><td><input name="ref" size="20" value="'.$album->ref.'"></td>';
print "<td valign=\"top\">Description</td></tr>";
print '<td>Titre</td><td><input name="titre" size="40" value="'.$album->titre.'"></td>';
print '<td valign="top" width="50%" rowspan="3"><textarea name="desc" rows="8" cols="50">';
print $album->description;
print "</textarea></td></tr>";
print '<tr><td>Année</td><TD><input name="annee" size="6" maxlenght="4" value="'.$album->annee.'"></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value="'.$album->price.'"></td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer"></td></tr>';
print '</form>';
$htmls = new Form($db);
$ga = new Groupart($db);
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"addga\">";
foreach ($gas as $key => $value)
{
print '<tr><td>Artiste/Groupe</td>';
print '<td><a href="../groupart/fiche.php?id='.$key.'">'.$value."</td></tr>\n";
}
print "<tr><td>Artiste/Groupe</td><td>";
$htmls->select_array("ga", $ga->liste_array());
print "</td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Ajouter"></td></tr>';
print "</form>";
print '</table>';
}
}
else
{
print "Fetch failed";
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">[<a href="fiche.php?action=updateosc&id='.$id.'">Update Osc</a>]</td>';
print '<td width="20%" align="center">-</td>';
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,75 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>";
print_liste_field_titre("Titre",$PHP_SELF, "a.title");
print "</td>";
print "<td></td>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?id=$objp->rowid\">$objp->title</a></TD>\n";
print '<TD align="right"><a href="'.OSC_CATALOG_URL.'product_info.php?products_id='.$objp->osc_id.'">url</a></TD>';
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,64 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
/*
*
*
*/
}
?>

View File

@ -0,0 +1,249 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 = "&nbsp;&nbsp;|--";
}
$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";
}
}
?>

View File

@ -0,0 +1,193 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<div class="titre">Nouvel album</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Référence</td><td><input name="ref" size="20" value=""></td></tr>';
print '<td>Titre</td><td><input name="titre" size="40" value=""></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value=""></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($id)
{
$album = new Album($db);
$result = $album->fetch($id);
if ( $result )
{
print '<div class="titre">Fiche Album : '.$album->titre.'</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print "<td>Référence</td><td>$album->ref</td>\n";
print "<td>Statut</td><td>$album->status</td></tr>\n";
print "<td>Titre</td><td>$album->titre</td>\n";
print '<td>Prix</td><TD>'.price($album->price).'</td></tr>';
print '<tr><td valign="top">Description</td><td valign="top">'.nl2br($album->description)."</td>";
$gas = $album->liste_groupart();
print '<td valign="top">Artiste/Groupe</td><td><ul>';
foreach ($gas as $key => $value)
{
print '<li><a href="../groupart/fiche.php?id='.$key.'">'.$value."</a></li>";
}
print "</ul></td></tr>\n";
print "</table>";
}
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche Album : '.$album->titre.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Référence</td><td><input name="ref" size="20" value="'.$album->ref.'"></td></tr>';
print '<td>Libellé</td><td><input name="titre" size="40" value="'.$album->titre.'"></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value="'.$album->price.'"></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print $album->description;
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer"></td></tr>';
print '</form>';
$htmls = new Form($db);
$ga = new Groupart($db);
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"addga\">";
foreach ($gas as $key => $value)
{
print '<tr><td>Artiste/Groupe</td>';
print '<td><a href="../groupart/fiche.php?id='.$key.'">'.$value."</td></tr>\n";
}
print "<tr><td>Artiste/Groupe</td><td>";
$htmls->select_array("ga", $ga->liste_array());
print "</td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Ajouter"></td></tr>';
print "</form>";
print '</table>';
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">[<a href="fiche.php?action=updateosc&id='.$id.'">Update Osc</a>]</td>';
print '<td width="20%" align="center">-</td>';
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,106 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>";
print_liste_field_titre("Titre",$PHP_SELF, "a.title");
print "</td>";
print "<td></td>";
print "</TR>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
printc($objp->categories_id,$db, 0);
$i++;
}
print "</TABLE>";
$db->free();
}
else
{
print $db->error();
}
Function printc($id, $db, $level)
{
$cat = new Categorie($db);
$cat->fetch($id);
print "<TR $bc[$var]><td>";
for ($i = 0 ; $i < $level ; $i++)
{
print "&nbsp;&nbsp;|--";
}
print "<a href=\"fiche.php?id=$objp->rowid\">".$cat->name."</a></TD>\n";
print "</TR>\n";
$childs = array();
$childs = $cat->liste_childs_array();
if (sizeof($childs))
{
foreach($childs as $key => $value)
{
printc($key,$db, $level+1);
}
}
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,80 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
/*
*
*
*/
}
?>

View File

@ -0,0 +1,155 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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();
}
}
}
?>

View File

@ -0,0 +1,187 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<div class="titre">Nouveau concert</div><br>';
$htmls = new Form($db);
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
$ga = new Groupart($db);
print "<tr><td>Date</td><td>";
print_date_select();
print "</td></tr>";
print "<tr><td>Lieu</td><td>";
$htmls->select_array("ga", $ga->liste_array());
print '</td></tr>';
$lc = new LieuConcert($db);
print "<tr><td>Lieu</td><td>";
$htmls->select_array("lc", $lc->liste());
print '<a href="fichelieu.php?action=create">Nouveau lieu</a></td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
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 '<div class="titre">Fiche Concert : '.$concert->titre.'</div><br>';
print '<table border="1" width="50%" cellspacing="0" cellpadding="4">';
print "<tr>";
print "<td>Date</td><td>".strftime("%A %d %B %Y",$concert->date)."</td>\n";
print '<tr><td valign="top">Artiste/Groupe</td><td valign="top">'.$groupart->nom_url."</td>";
print '<tr><td valign="top">Lieu</td><td valign="top">'.$lieuconcert->nom_url."</td>";
print '<tr><td valign="top">Description</td><td valign="top">'.nl2br($concert->description)."</td>";
print "</table>";
}
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche Concert : '.$concert->titre.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Référence</td><td><input name="ref" size="20" value="'.$concert->ref.'"></td></tr>';
print '<td>Libellé</td><td><input name="titre" size="40" value="'.$concert->titre.'"></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value="'.$concert->price.'"></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print $concert->description;
print "</textarea></td></tr>";
print '</form>';
print '</table>';
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">[<a href="fiche.php?action=updateosc&id='.$id.'">Update Osc</a>]</td>';
print '<td width="20%" align="center">-</td>';
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,155 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<div class="titre">Nouveau lieu de concert</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Nom</td><td><input name="nom" size="40" value=""></td></tr>';
print '<td>Ville</td><td><input name="ville" size="40" value=""></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($id)
{
$lieuconcert = new LieuConcert($db);
$result = $lieuconcert->fetch($id);
if ( $result )
{
print '<div class="titre">Fiche lieu de concert : '.$lieuconcert->nom.'</div><br>';
print '<table border="1" width="50%" cellspacing="0" cellpadding="4">';
print "<tr><td>Nom</td><td>$lieuconcert->nom</td></tr>\n";
print "<tr><td>Ville</td><td>$lieuconcert->ville</td></tr>\n";
print '<tr><td valign="top">Description</td><td valign="top">';
print nl2br($lieuconcert->description)."</td></tr>";
print "</table>";
}
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche lieu de concert : '.$lieuconcert->nom.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td>Nom</td><td><input name="nom" size="40" value="'.$lieuconcert->nom.'"></td></tr>';
print '<tr><td>Ville</td><td><input name="ville" size="40" value="'.$lieuconcert->ville.'"></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print $lieuconcert->description;
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer"></td></tr>';
print '</form>';
print '</table>';
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fichelieu.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,83 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>";
print_liste_field_titre("Titre",$PHP_SELF, "a.title");
print "</td><td>";
print_liste_field_titre("Artiste/Groupe",$PHP_SELF, "ga.nom");
print "</td><td>";
print_liste_field_titre("Salle",$PHP_SELF, "lc.nom");
print "</td><td>";
print_liste_field_titre("Ville",$PHP_SELF, "lc.ville");
print "</td>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?id=$objp->rowid\">$objp->dc</a></TD>\n";
print '<TD><a href="product_info.php?products_id='.$objp->osc_id.'">'.$objp->nom.'</a></TD>';
print '<TD><a href="product_info.php?products_id='.$objp->osc_id.'">'.$objp->lieu.'</a></TD>';
print '<TD>'.$objp->ville.'</TD>';
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,155 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 = '<a href="/product/concert/fichelieu.php?id='.$result["rowid"].'">'.$result["nom"].'</a>';
}
$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();
}
}
}
?>

View File

@ -0,0 +1,67 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
/*
*
*
*/
}
?>

View File

@ -0,0 +1,76 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>";
print_liste_field_titre("Nom",$PHP_SELF, "lc.nom");
print "</td><td>";
print_liste_field_titre("Ville",$PHP_SELF, "lc.ville");
print "</td>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fichelieu.php?id=$objp->rowid\">$objp->nom</a></TD>\n";
print "<TD>$objp->ville</TD>\n";
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,157 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<div class="titre">Nouvel Artiste/Groupe</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td>Nom</td><td><input name="nom" size="40" value=""></td></tr>';
print '<tr><td>Artiste/Groupe</td><td><select name="groupart"><option value="artiste">Artiste</option>';
print '<option value="groupe">Groupe</option></select></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($id)
{
$groupart = new Groupart($db);
$result = $groupart->fetch($id);
if ( $result )
{
print '<div class="titre">Fiche Artiste/Groupe</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print "<td>Nom</td><td>$groupart->nom</td></tr>\n";
print "<tr><td valign=\"top\">Description</td><td>".nl2br($groupart->description)."</td></tr>";
$gas = $groupart->liste_albums();
print '<tr><td>Album(s)</td><td><ul>';
foreach ($gas as $key => $value)
{
print '<li><a href="../album/fiche.php?id='.$key.'">'.$value."</a></li>";
}
print "</ul></td></tr>\n";
print "</table>";
}
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche produit : '.$groupart->ref.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td>Nom</td><td><input name="nom" size="40" value="'.$groupart->nom.'"></td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print $groupart->description;
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer"></td></tr>';
print '</table>';
print '</form>';
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">[<a href="fiche.php?action=updateosc&id='.$id.'">Update Osc</a>]</td>';
print '<td width="20%" align="center">-</td>';
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,206 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 = '<a href="/product/groupart/fiche.php?id='.$result["rowid"].'">'.$result["nom"].'</a>';
}
$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";
}
}
?>

View File

@ -0,0 +1,75 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>";
print_liste_field_titre("Réf",$PHP_SELF, "p.ref");
print "</td>";
print "<td></td>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?id=$objp->rowid\">$objp->nom</a></TD>\n";
print "<TD>$objp->groupart</TD>\n";
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,59 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
/*
*
*
*/
}
?>

View File

@ -1,5 +1,5 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
/*
*