if ($title != "") { echo $title . " :"; } echo "<div class=\"membarfree\" style=\"width: " . $width . "px\">"; if ($cache > 0) { printf("<div class=\"membarcache\" style=\"width: %.0fpx\">", $wused); $wused = ($used - $cache) / $max * $width; } printf("<div class=\"membarused\" style=\"width: %.0fpx\"></div>", $wused); if ($cache > 0) { echo "</div>"; } echo "</div>\n"; } function get_process() { return xmlCall("base.listProcess", null); } $arr = get_process(); if (count($arr) == 0) { //if no job in background print '<div style="text-align: center;">' . _("No job.") . '</div>'; return; } foreach ($arr as $ps) { echo $ps[0] . "<br/>"; echo $ps[2] . "<br/>"; if ($ps[1] != "-1") { print_mem_bar("progress", 100, $ps[1]); } }
function print_health() { $up = xmlCall("base.getUptime"); $up = trim($up); list($up) = explode(" ", $up); $days = (int) ($up / (24*60*60)); $up -= $days * 24*60*60; $hrs = (int)($up / (60*60)); $up -= $hrs * 60*60; $mins = (int)($up / 60); ($days > 1) ? $d = "s" : $d = ""; ($hrs > 1) ? $h = "s" : $h = ""; ($mins > 1) ? $m = "s" : $m = ""; echo _("Uptime: "); if ($days > 0) { echo $days." "._("day").$d." "; } if (($days > 0) || ($hrs > 0)) { echo $hrs." "._("hour").$h." "; } echo $mins." "._("minute").$m."<br/><br/>\n"; $mem = xmlCall("base.getMemoryInfos"); $m = preg_split("/[ ]+/", $mem[1]); print_mem_bar(_("Memory"), $m[1], $m[2],$m[5]+$m[6]); $m = preg_split("/[ ]+/", $mem[3]); if ($m[1] > 0) { print_mem_bar(_("Swap"), $m[1], $m[2]); } }