diff --git a/htdocs/telephonie/stats/graph/line.class.php b/htdocs/telephonie/stats/graph/line.class.php new file mode 100644 index 00000000000..f3256b45822 --- /dev/null +++ b/htdocs/telephonie/stats/graph/line.class.php @@ -0,0 +1,92 @@ + + * + * 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); + } +} +?> diff --git a/htdocs/telephonie/stats/lignes/actives.class.php b/htdocs/telephonie/stats/lignes/actives.class.php new file mode 100644 index 00000000000..5644457728a --- /dev/null +++ b/htdocs/telephonie/stats/lignes/actives.class.php @@ -0,0 +1,102 @@ + + * + * 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); + + } + +} + +?> diff --git a/htdocs/telephonie/stats/lignes/index.php b/htdocs/telephonie/stats/lignes/index.php new file mode 100644 index 00000000000..7f0fb128c52 --- /dev/null +++ b/htdocs/telephonie/stats/lignes/index.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("./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 '
';
+
+print '![]() '."\n"; + +/* + * + * + */ + +print ' |