From b1ac4328112535b06752cced645af5a11f6eebf8 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 14 Feb 2005 15:59:07 +0000 Subject: [PATCH] =?UTF-8?q?Am=E9lioration=20g=E9n=E9rale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stats/graph/joursemaine.class.php | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/htdocs/telephonie/stats/graph/joursemaine.class.php b/htdocs/telephonie/stats/graph/joursemaine.class.php index a61457c03d5..e375f11990c 100644 --- a/htdocs/telephonie/stats/graph/joursemaine.class.php +++ b/htdocs/telephonie/stats/graph/joursemaine.class.php @@ -41,7 +41,35 @@ class GraphJoursemaine extends GraphBrouzouf{ Function GraphDraw($g) { - $this->GraphMakeGraph($g,array('Lun','Mar','Mer','Jeu','Ven','Sam','Dim')); + + + $sql = "SELECT ".$this->db->pdate("date")." as date, duree"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; + + if ($this->db->query($sql)) + { + + $jour_semaine_nb = array(); + $jour_semaine_duree = array(); + + $num = $this->db->num_rows(); + + $i = 0; + + while ($i < $num) + { + $obj = $this->db->fetch_object(); + + $u = strftime("%u",$obj->date) - 1; // 1 pour Lundi + + $jour_semaine_nb[$u]++; + $jour_semaine_duree[$u] += $obj->duree; + + $i++; + } + } + + $this->GraphMakeGraph($jour_semaine_nb,array('Lun','Mar','Mer','Jeu','Ven','Sam','Dim')); } }