diff --git a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php b/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php index ea0930a3816856c6c1249fd835c7f18abd98bc5f..6dc9f8e4469d066c767eec6ad3ed72b43329a86e 100644 --- a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php +++ b/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php @@ -20,9 +20,9 @@ * */ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); +require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -class GraphAppelsDureeMoyenne extends GraphBrouzouf{ +class GraphAppelsDureeMoyenne extends GraphBar{ Function GraphAppelsDureeMoyenne($DB, $file) @@ -30,6 +30,9 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $this->db = $DB; $this->file = $file; + $this->datas = array(); + $this->labels = array(); + $this->client = 0; $this->contrat = 0; $this->ligne = 0; @@ -40,8 +43,17 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ $this->barcolor = "pink"; } + Function Graph($datas='', $labels='') + { + $this->GetDatas(); + + if (sizeof($this->datas)) + { + $this->GraphDraw($this->file, $this->datas, $this->labels); + } + } - Function GraphDraw() + Function GetDatas() { $num = 0; @@ -83,14 +95,13 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ { $num = $this->db->num_rows(); $i = 0; - $labels = array(); while ($i < $num) { $row = $this->db->fetch_row(); - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $datas[$i] = ($row[1] / $row[2] ) ; + $this->labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); + $$this->datas[$i] = ($row[1] / $row[2] ) ; $i++; } @@ -108,11 +119,6 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{ { print $this->client . " " . $cv[$i - 1]."\n"; } - - if ($num > 1) - { - $this->GraphMakeGraph($datas, $labels); - } } }