function deleteCountingData($dates, $period, $cpList, $fcp, $excluded = null) { for ($i = 0; $i < count($dates); $i++) { for ($j = 0; $j < count($cpList); $j++) { if ($excluded === null or !in_array($cpList[$j]["cpId"], $excluded)) { $indicator = $fcp->getIndicator($cpList[$j]["cpId"]); $indicator->deleteValues($cpList[$j]["cpId"], mkTimeFromString($dates[$i]), $period["hstart"], $period["hend"]); } } } }
function showCountingData($dates, $period, $cpList, $fcp, $excluded = null) { $str = sprintf("%2s%20s%5s%5s%5s%5s%5s%5s\n%'-52s\n", "id", "start", "v0", "c0", "e0", "v1", "c1", "e1", "-"); $total = array("value0" => 0, "nbcumul0" => 0, "nbexpected0" => 0, "value1" => 0, "nbcumul1" => 0, "nbexpected1" => 0); for ($i = 0; $i < count($dates); $i++) { for ($j = 0; $j < count($cpList); $j++) { if ($excluded === null or !in_array($cpList[$j]["cpId"], $excluded)) { $indicator = $fcp->getIndicator($cpList[$j]["cpId"]); $data = $indicator->getValuesHour($cpList[$j]["cpId"], mkTimeFromString($dates[$i]), $period["hstart"], $period["hend"]); if (is_array($data)) { foreach ($data as $v) { $str .= sprintf("%2s%20s%5d%5d%5d%5d%5d%5d\n", $v["id"], $v["start"], $v["value0"], $v["nbcumul0"], $v["nbexpected0"], $v["value1"], $v["nbcumul1"], $v["nbexpected1"]); foreach (array_keys($total) as $key) { $total[$key] += $v[$key]; } } } } } } $str .= sprintf("%'-52s\n%22s%5d%5d%5d%5d%5d%5d\n", "-", "Total = ", $total["value0"], $total["nbcumul0"], $total["nbexpected0"], $total["value1"], $total["nbcumul1"], $total["nbexpected1"]); return $str; }