PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/html/pages/device/overview/current.inc.php

https://github.com/observernms/core
PHP | 45 lines | 37 code | 8 blank | 0 comment | 6 complexity | 566877c9979e4c7601a1474adb073b65 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. <?php
  2. unset($current_seperator);
  3. if(mysql_result(mysql_query("SELECT count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"),0)) {
  4. $total = mysql_result(mysql_query("SELECT count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"),0);
  5. $rows = round($total / 2,0);
  6. echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
  7. echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/current.png'> Current</p>");
  8. $i = '1';
  9. $currents = mysql_query("SELECT * FROM current WHERE device_id = '" . $device['device_id'] . "'");
  10. echo("<table width=100% valign=top>");
  11. echo("<tr><td width=50%>");
  12. echo("<table width=100% cellspacing=0 cellpadding=2>");
  13. while($current = mysql_fetch_array($currents)) {
  14. if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
  15. $graph_colour = str_replace("#", "", $row_colour);
  16. $current_day = "graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=300&height=100";
  17. $current_week = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=300&height=100";
  18. $current_month = "graph.php?id=" . $current['current_id'] . "&type=current&from=$month&to=$now&width=300&height=100";
  19. $current_year = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
  20. $current_minigraph = "<img src='graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
  21. $current_link = "<a href='/device/".$device['device_id']."/health/current/' onmouseover=\"return ";
  22. $current_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$current['current_descr'];
  23. $current_link .= "</div><div style=\'width: 750px\'><img src=\'$current_day\'><img src=\'$current_week\'><img src=\'$current_month\'><img src=\'$current_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
  24. $current_link_c = $current_link . "<span " . ($current['current_current'] < $current['current_limit_low'] || $current['current_current'] > $current['current_limit'] ? "style='color: red'" : '') . '>' . $current['current_current'] . "A</span></a>";
  25. $current_link_b = $current_link . $current_minigraph . "</a>";
  26. $current_link_a = $current_link . $current['current_descr'] . "</a>";
  27. $current['current_descr'] = truncate($current['current_descr'], 25, '');
  28. echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$current_link_a</strong></td><td width=80 align=right class=tablehead>$current_link_b<td width=80 align=right class=tablehead>$current_link_c</td></tr>");
  29. if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
  30. $i++;
  31. }
  32. echo("</table>");
  33. echo("</td></tr>");
  34. echo("</table>");
  35. echo("</div>");
  36. }
  37. ?>