70 |
$data = array(); |
$data = array(); |
71 |
$datas = array(); |
$datas = array(); |
72 |
$moydata = array(); |
$moydata = array(); |
73 |
|
$moydatas = array(); |
74 |
|
|
75 |
$sqla = "SELECT date, sum(duree)"; |
$sqla = "SELECT date, sum(duree)"; |
76 |
$sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; |
$sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; |
88 |
{ |
{ |
89 |
$jour = (substr($rowa[0],0,2) * 1); |
$jour = (substr($rowa[0],0,2) * 1); |
90 |
$data[$jour] = ($rowa[1]/60); |
$data[$jour] = ($rowa[1]/60); |
91 |
$total = $total + $data[$i]; |
$total = $total + $data[$jour]; |
|
$moydata[$i] = $total / ($i+1); |
|
92 |
$i++; |
$i++; |
93 |
|
$moydata[$jour] = $total / $i; |
94 |
} |
} |
95 |
} |
} |
96 |
|
|
97 |
for ($i = 0 ; $i < 31 ; $i++) |
for ($i = 0 ; $i < 31 ; $i++) |
98 |
{ |
{ |
99 |
$j = $i + 1; |
$j = $i + 1; |
100 |
$datas[$i] = $data[$j]; |
$datas[$i] = 0; |
101 |
|
$moydatas[$i] = 0; |
102 |
|
if ($data[$j]) |
103 |
|
$datas[$i] = $data[$j]; |
104 |
|
if ($moydata[$j]) |
105 |
|
$moydatas[$i] = $moydata[$j]; |
106 |
$labels[$i] = $j; |
$labels[$i] = $j; |
107 |
} |
} |
108 |
|
|
125 |
$b2plot->SetColor("red"); |
$b2plot->SetColor("red"); |
126 |
$graph->Add($b2plot); |
$graph->Add($b2plot); |
127 |
|
|
128 |
$lineplot = new LinePlot($moydata); |
$lineplot = new LinePlot($moydatas); |
129 |
$lineplot->SetColor("blue"); |
$lineplot->SetColor("blue"); |
130 |
$graph->Add($lineplot); |
$graph->Add($lineplot); |
131 |
|
|
132 |
$graph->img->SetImgFormat("png"); |
$graph->img->SetImgFormat("png"); |
133 |
$graph->Stroke($file); |
$graph->Stroke($file); |
|
|
|
|
|
|
134 |
} |
} |
135 |
} |
} |
136 |
else |
else |