Qual: Toutes les gnrations d'images se font dans un rpertoire nomm $conf->module->dir_images. Cela rend uniforme le code qui des fois utilisait des chemins en dir, des fois document avec s et des fois sans.

Toutes les images sont dornavant dans htdocs/images.
This commit is contained in:
Laurent Destailleur 2004-12-04 19:20:19 +00:00
parent 77ed5884da
commit dd7753df19
2 changed files with 6 additions and 116 deletions

View File

@ -71,14 +71,13 @@ if ($_GET["id"])
rmdir(DOL_DOCUMENT_ROOT."/document/produits");
// Création répertoire pour images générées
$dir = DOL_DOCUMENT_ROOT."/document/produit/".$product->id;
$dir = $conf->produit->dir_images."/".$product->id;
if (! file_exists($dir))
{
umask(0);
if(!file_exists(DOL_DOCUMENT_ROOT."/document/produit")) {
mkdir(DOL_DOCUMENT_ROOT."/document");
mkdir(DOL_DOCUMENT_ROOT."/document/produit");
if(!file_exists($conf->produit->dir_images)) {
mkdir($conf->produit->dir_images);
}
if (! mkdir($dir, 0755))
{
@ -86,7 +85,6 @@ if ($_GET["id"])
}
}
$img_propal_name = "propal12mois.png";
$filenbpropal = $dir . "/" . $img_propal_name;
$filenbvente = $dir . "/vente12mois.png";
@ -176,10 +174,10 @@ if ($_GET["id"])
print '<td align="center" width="50%" colspan="2">Nombre de pièces vendues</td></tr>';
print '<tr><td align="center" colspan="2">';
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/vente12mois.png" alt="Ventes sur les 12 derniers mois">';
print '<img src="'.$conf->produit->url_images."/".$product->id.'/vente12mois.png" alt="Ventes sur les 12 derniers mois">';
print '</td><td align="center" colspan="2">';
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/vendu12mois.png" alt="Ventes sur les 12 derniers mois">';
print '<img src="'.$conf->produit->url_images."/".$product->id.'/vendu12mois.png" alt="Ventes sur les 12 derniers mois">';
print '</td></tr><tr>';
if (file_exists($filenbvente) && filemtime($filenbvente))
@ -206,7 +204,7 @@ if ($_GET["id"])
print '<td align="center" width="50%" colspan="2">-</td></tr>';
print '<tr><td align="center" colspan="2">';
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/'.$img_propal_name.'" alt="Propales sur les 12 derniers mois">';
print '<img src="'.$conf->produit->url_images."/".$product->id.'/'.$img_propal_name.'" alt="Propales sur les 12 derniers mois">';
print '</td><td align="center" colspan="2">TODO AUTRE GRAPHIQUE';

View File

@ -1,108 +0,0 @@
<?php
/* 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
* 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");
require("../commande.class.php");
require("../../graph.class.php");
require("./commandestats.class.php");
llxHeader();
$mesg = '';
/*
*
*
*/
$stats = new CommandeStats($db);
$year = $_GET["year"];
print_fiche_titre('Statistiques commandes '.$year, $mesg);
$dir = DOL_DOCUMENT_ROOT;
////////////////////////
$res = $stats->getNbCommandeByMonth($year);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
}
$filev = "/document/images/commande.png";
$px = new Graph();
$px->SetYLabel("Nombre de commande");
$px->draw($dir.$filev, $data, $year);
$res = $stats->getCommandeAmountByMonth($year);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
}
$file_amount = "/document/images/commandeamount.png";
$px = new Graph();
$px->SetYLabel("Montant des commande");
$px->draw($dir.$file_amount, $data, $year);
$res = $stats->getCommandeAverageByMonth($year);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
}
$file_avg = "/document/images/commandeaverage.png";
$px = new Graph();
$px->SetYLabel("Montant moyen des commande");
$px->draw($dir.$file_avg, $data, $year);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td align="center">Nombre de commande par mois</td>';
print '<td align="center">';
print '<img src="'.DOL_URL_ROOT.$filev.'">';
print '</td></tr>';
print '<tr><td align="center">Sommes des commandes</td>';
print '<td align="center">';
print '<img src="'.DOL_URL_ROOT.$file_amount.'">';
print '</td></tr>';
print '<tr><td align="center">Montant moyen des commande</td>';
print '<td align="center">';
print '<img src="'.DOL_URL_ROOT.$file_avg.'">';
print '</td></tr></table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>