Amlioration gnrale
This commit is contained in:
parent
b1ac432811
commit
e680c4f464
@ -150,45 +150,15 @@ $graphgain->GraphDraw();
|
||||
/*
|
||||
/*************************************************************************/
|
||||
|
||||
$sql = "SELECT ".$db->pdate("date")." as date, duree";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$heure_appel = array();
|
||||
$jour_semaine_nb = array();
|
||||
$jour_semaine_duree = array();
|
||||
|
||||
$num = $db->num_rows();
|
||||
if ($verbose) print "$num lignes de comm a traiter\n";
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
|
||||
$h = strftime("%H",$obj->date) * 1; // suppression du 0
|
||||
|
||||
$heure_appel_nb[$h]++;
|
||||
$heure_appel_duree[$h] += $obj->duree;
|
||||
|
||||
$u = strftime("%u",$obj->date) - 1; // 1 pour Lundi
|
||||
|
||||
$jour_semaine_nb[$u]++;
|
||||
$jour_semaine_duree[$u] += $obj->duree;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $img_root . "communications/heure_appel_nb.png";
|
||||
if ($verbose) print "Heures d'appels\n";
|
||||
$graphha = new GraphHeureAppel ($db, $file);
|
||||
$graphha->GraphDraw($heure_appel_nb);
|
||||
$graphha->GraphDraw();
|
||||
|
||||
$file = $img_root . "communications/joursemaine_nb.png";
|
||||
if ($verbose) print "Jours de semaines\n";
|
||||
$graphha = new GraphJourSemaine ($db, $file);
|
||||
$graphha->GraphDraw($jour_semaine_nb);
|
||||
$graphha->GraphDraw();
|
||||
|
||||
repart_comm($db);
|
||||
|
||||
|
||||
@ -22,9 +22,8 @@
|
||||
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php");
|
||||
|
||||
class GraphHeureAppel extends GraphBrouzouf{
|
||||
|
||||
|
||||
class GraphHeureAppel extends GraphBrouzouf
|
||||
{
|
||||
Function GraphHeureAppel($DB, $file)
|
||||
{
|
||||
$this->db = $DB;
|
||||
@ -41,7 +40,33 @@ class GraphHeureAppel extends GraphBrouzouf{
|
||||
|
||||
Function GraphDraw($g)
|
||||
{
|
||||
$this->GraphMakeGraph($g, $labels);
|
||||
|
||||
$sql = "SELECT ".$this->db->pdate("date")." as date, duree";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$heure_appel = array();
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
|
||||
$h = ceil(strftime("%H",$obj->date)); // suppression du 0
|
||||
|
||||
$heure_appel_nb[$h]++;
|
||||
$heure_appel_duree[$h] += $obj->duree;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$this->GraphMakeGraph($heure_appel_nb, $labels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -39,10 +39,8 @@ class GraphJoursemaine extends GraphBrouzouf{
|
||||
$this->barcolor = "green";
|
||||
}
|
||||
|
||||
Function GraphDraw($g)
|
||||
Function GraphDraw()
|
||||
{
|
||||
|
||||
|
||||
$sql = "SELECT ".$this->db->pdate("date")." as date, duree";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
||||
|
||||
@ -68,8 +66,11 @@ class GraphJoursemaine extends GraphBrouzouf{
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->GraphMakeGraph($jour_semaine_nb,array('Lun','Mar','Mer','Jeu','Ven','Sam','Dim'));
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$this->GraphMakeGraph($jour_semaine_nb,array('Lun','Mar','Mer','Jeu','Ven','Sam','Dim'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user