echo "</TR>\n"; while ($result->fetchInto($row)) { echo "<TR>"; $rkeys = array_keys($row); foreach ($rkeys as $key) { $data[$key] = array_shift($row); if ($col[$key] == "submit_ts" || $col[$key] == "start_ts" || $col[$key] == "end_ts") { echo "<TD><PRE>" . date("Y-m-d H:i:s", $data[$key]) . "</PRE></TD>\n"; } else { if ($col[$key] == "jobid") { $jobid_nodot = ereg_replace('\\..*', '', $data[$key]); echo "<TD><PRE><A HREF=\"", "jobinfo.php?jobid={$jobid_nodot}", "&system={$_POST['system']}&all=1\"\\>", htmlspecialchars($jobid_nodot), "</A></PRE></TD>"; } else { echo "<TD><PRE>" . htmlspecialchars($data[$key]) . "</PRE></TD>"; } } } echo "</TR>\n"; } echo "</TABLE>\n"; db_disconnect($db); bookmarkable_url(); } else { begin_form("problem-jobs.php"); system_chooser(); date_fields(); $props = array("username", "groupname", "jobname", "nproc", "mppe", "mppssp", "nodes", "queue", "submit_ts", "start_ts", "end_ts", "cput_req", "cput", "walltime_req", "walltime", "mem_req", "mem_kb", "vmem_req", "vmem_kb", "hostlist", "exit_status", "script"); checkboxes_from_array("Properties", $props); end_form(); } page_footer();
echo "</TR>\n"; ob_flush(); flush(); } echo "</TABLE>\n"; if (isset($_POST['xls'])) { $xlsresult = db_query($db, $sql); $columns = array("package", "jobcount", "cpuhours", "users", "groups"); result_as_xls($xlsresult, $columns, $_POST['system'] . "-software_usage-" . $_POST['start_date'] . "-" . $_POST['end_date']); } if (isset($_POST['ods'])) { $odsresult = db_query($db, $sql); $columns = array("package", "jobcount", "cpuhours", "users", "groups"); result_as_ods($odsresult, $columns, $_POST['system'] . "-software_usage-" . $_POST['start_date'] . "-" . $_POST['end_date']); } } db_disconnect($db); bookmarkable_url(); } else { begin_form("usage-summary.php"); system_chooser(); date_fields(); $orders = array("jobcount", "cpuhours", "users", "groups"); checkboxes_from_array("Supplemental reports", array("institution", "software")); $defaultorder = "cpuhours"; pulldown("order", "Order results by", $orders, $defaultorder); checkbox("Generate Excel files for supplemental reports", "xls"); checkbox("Generate ODF files for supplemental reports", "ods"); end_form(); } page_footer();
$sql .= $pkgmatch[$key]; } else { $sql .= "script LIKE '%" . $key . "%' OR software LIKE '%" . $key . "%'"; } $sql .= " ) AND ( " . dateselect("start", $_POST['start_date'], $_POST['end_date']) . " ) GROUP BY month;"; #echo "<PRE>".htmlspecialchars($sql)."</PRE>"; $result = db_query($db, $sql); echo "<TABLE border=1>\n"; echo "<TR><TH>month</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>cpuhours_alt</TH><TH>users</TH><TH>groups</TH></TR>\n"; while ($result->fetchInto($row)) { $rkeys = array_keys($row); echo "<TR>"; foreach ($rkeys as $rkey) { $data[$rkey] = array_shift($row); echo "<TD align=\"right\"><PRE>" . $data[$rkey] . "</PRE></TD>"; } echo "</TR>\n"; } echo "</TABLE>\n"; } } db_disconnect($db); bookmarkable_url(); } else { begin_form("software-usage-by-month.php"); system_chooser(); date_fields(); checkboxes_from_array("Packages", $packages); end_form(); } page_footer();