function PrintAChart($IdOfChart, $username, $strDateFrom, $strDateTo, $PrevMonth, $EditMode, $timezone) { $done_array1 = CollectData(1, $username, $strDateFrom, $strDateTo); $done_array0 = CollectData(0, $username, $strDateFrom, $strDateTo); $done_array2 = CollectData(2, $username, $strDateFrom, $strDateTo); $done_array_1 = CollectData(-100, $username, $strDateFrom, $strDateTo); //Empty data to skip cyan color in chart $done_array3 = CollectData(-1, $username, $strDateFrom, $strDateTo); $MyFinalArray = array($done_array1, $done_array0, $done_array2, $done_array_1, $done_array3); $MyChart = MakeMyChart($MyFinalArray, "Напрегнатост", "area", "c" . $IdOfChart); $MyDate = date_create($done_array1[6][0]); $MyLastDayOfThisWeekMonth = date_format($MyDate, "m"); $MyYearToShow = date_format($MyDate, "Y"); if ($MyLastDayOfThisWeekMonth != $PrevMonth) { echo '<div class="page-header">'; echo '<h1 style = "color:#837d7c;">' . ConvertMonthToWord($MyLastDayOfThisWeekMonth) . " " . $MyYearToShow . '</h1>'; echo '</div>'; } if ($_GET["width"] < 385 && $_GET["height"] > $_GET["width"]) { $MyWidth = 160; $MyLeftMargin = -30; } else { if ($_GET["width"] >= 385 && ($_GET["width"] < 530 && $_GET["height"] > $_GET["width"])) { $MyWidth = 140; $MyLeftMargin = -18; } else { if ($_GET["width"] >= 530 && $_GET["height"] > $_GET["width"]) { $MyWidth = 132; $MyLeftMargin = -13; } else { $MyWidth = 100; $MyLeftMargin = 0; } } } if ($_GET["height"] > $_GET["width"]) { $MyButtonWidth = 100; $MyButtonLeftMargin = 0; } else { $MyButtonWidth = $MyWidth; $MyButtonLeftMargin = 8; } $MyHeight = 75; PrintMyWeekDropdownButtons($MyFinalArray[0], $EditMode, $username, $MyButtonWidth, $MyButtonLeftMargin, 0, $timezone); echo '<div style="margin-left:' . $MyLeftMargin . '%;width:' . $MyWidth . '%;height:' . $MyHeight . '%; min-width:100px;">'; echo $MyChart; echo '</div>'; return $MyLastDayOfThisWeekMonth; }
$period = dbFetchCell("SELECT UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - UNIX_TIMESTAMP('" . mres($prev_timestamp) . "')"); } else { $prev_delta = '0'; $period = '0'; $prev_in_delta = '0'; $prev_out_delta = '0'; } if ($delta < '0') { $delta = $prev_delta; $in_delta = $prev_in_delta; $out_delta = $prev_out_delta; } if (!empty($period) && $period < '0') { logfile("BILLING: negative period! id:{$bill_id} period:{$period} delta:{$delta} in_delta:{$in_delta} out_delta:{$out_delta}"); } else { dbInsert(array('bill_id' => $bill_id, 'timestamp' => $now, 'period' => $period, 'delta' => $delta, 'in_delta' => $in_delta, 'out_delta' => $out_delta), 'bill_data'); } } //end CollectData() if ($argv[1]) { CollectData($argv[1]); } $poller_end = microtime(true); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5); dbInsert(array('type' => 'pollbill', 'doing' => $doing, 'start' => $poller_start, 'duration' => $poller_time, 'devices' => 0, 'poller' => $config['distributed_poller_name']), 'perf_times'); if ($poller_time > 300) { logfile("BILLING: polling took longer than 5 minutes ({$poller_time} seconds)!"); } echo "\nCompleted in {$poller_time} sec\n"; rrdtool_close();