Nouveau fichier
This commit is contained in:
parent
a816e06407
commit
6396b174aa
92
htdocs/telephonie/stats/graph/line.class.php
Normal file
92
htdocs/telephonie/stats/graph/line.class.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 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_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php");
|
||||
|
||||
class GraphLine extends DolibarrGraph {
|
||||
|
||||
Function GraphLine($DB, $file)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->file = $file;
|
||||
$this->bgcolor = "#DEE7EC";
|
||||
$this->barcolor = "green";
|
||||
$this->client = 0;
|
||||
$this->showframe = true;
|
||||
}
|
||||
|
||||
Function GraphDraw($file, $datas, $labels)
|
||||
{
|
||||
// Create the graph. These two calls are always required
|
||||
|
||||
$height = 240;
|
||||
$width = 400;
|
||||
|
||||
if ($this->width <> $width && $this->width > 0)
|
||||
$width = $this->width;
|
||||
|
||||
if ($this->height <> $height && $this->height > 0)
|
||||
$height = $this->height;
|
||||
|
||||
$graph = new Graph($width, $height,"auto");
|
||||
$graph->SetScale("textlin");
|
||||
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
|
||||
$graph->SetFrame($this->showframe);
|
||||
|
||||
$graph->img->SetMargin(40,20,20,40);
|
||||
|
||||
$b2plot = new LinePlot($datas);
|
||||
|
||||
$b2plot->SetFillColor($this->barcolor);
|
||||
|
||||
$graph->xaxis->scale->SetGrace(20);
|
||||
|
||||
$LabelAngle = 45;
|
||||
if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0)
|
||||
$LabelAngle = $this->LabelAngle;
|
||||
|
||||
$graph->xaxis->SetLabelAngle($LabelAngle);
|
||||
|
||||
$graph->xaxis->SetTextLabelInterval($this->LabelInterval);
|
||||
|
||||
$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8);
|
||||
|
||||
$graph->Add($b2plot);
|
||||
|
||||
$graph->title->Set($this->titre);
|
||||
|
||||
$graph->title->SetFont(FF_VERDANA,FS_NORMAL);
|
||||
|
||||
$graph->yaxis->title->SetFont(FF_FONT2);
|
||||
$graph->xaxis->title->SetFont(FF_FONT1);
|
||||
|
||||
$graph->xaxis->SetTickLabels($labels);
|
||||
|
||||
// Display the graph
|
||||
|
||||
$graph->img->SetImgFormat("png");
|
||||
$graph->Stroke($file);
|
||||
}
|
||||
}
|
||||
?>
|
||||
102
htdocs/telephonie/stats/lignes/actives.class.php
Normal file
102
htdocs/telephonie/stats/lignes/actives.class.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 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_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/line.class.php");
|
||||
|
||||
class GraphLignesActives extends GraphLine {
|
||||
|
||||
|
||||
Function GraphLignesActives($DB, $file)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->file = $file;
|
||||
|
||||
$this->client = 0;
|
||||
$this->titre = "Lignes Actives";
|
||||
|
||||
$this->barcolor = "green";
|
||||
$this->showframe = true;
|
||||
}
|
||||
|
||||
|
||||
Function GraphMakeGraph()
|
||||
{
|
||||
$num = 0;
|
||||
|
||||
$sql = "SELECT dates, statut,nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_ligne_statistique";
|
||||
$sql .= " WHERE statut = 3";
|
||||
$sql .= " ORDER BY dates ASC";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
$j = -1;
|
||||
$attente = array();
|
||||
$acommander = array();
|
||||
$commandee = array();
|
||||
$active = array();
|
||||
$last = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
|
||||
if ($last <> $row[0])
|
||||
{
|
||||
$j++;
|
||||
$labels[$j] = substr($row[0],5,2)."/".substr($row[0],2,2);
|
||||
$attente[$j] = 0;
|
||||
$acommander[$j] = 0;
|
||||
$commandee[$j] = 0;
|
||||
$active[$j] = 0;
|
||||
$last = $row[0];
|
||||
}
|
||||
|
||||
if ($row[1] == 3)
|
||||
{
|
||||
$active[$j] = $row[2];
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' ' . $sql;
|
||||
}
|
||||
|
||||
|
||||
$this->LabelInterval = round($num / 20,0);
|
||||
|
||||
$this->GraphDraw($this->file, $active, $labels);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
67
htdocs/telephonie/stats/lignes/index.php
Normal file
67
htdocs/telephonie/stats/lignes/index.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 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");
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
|
||||
if (!$user->rights->telephonie->lire)
|
||||
accessforbidden();
|
||||
|
||||
llxHeader('','Telephonie - Statistiques - Lignes');
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/lignes/index.php';
|
||||
$head[$h][1] = "Global";
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, "Lignes");
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<tr><td valign="top">';
|
||||
|
||||
print '<img src="'.DOL_URL_ROOT.'/showgraph.php?graph='.DOL_DATA_ROOT.'/graph/telephonie/lignes/lignes.actives.png" alt="Lignes Actives" title="Lignes Actives"><br /><br />'."\n";
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user