1
0

index.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/devtypesfilter.php");
  5. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/buildingfilter.php");
  6. $default_sort='device_name';
  7. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sortfilter.php");
  8. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  9. print_device_submenu($page_url);
  10. $sort_sql=" ORDER BY device_name";
  11. if (!empty($sort_field) and !empty($order)) { $sort_sql = " ORDER BY $sort_field $order"; }
  12. ?>
  13. <div id="cont">
  14. <br>
  15. <form name="def" action="index.php" method="post">
  16. <table class="data">
  17. <tr class="info" align="right">
  18. <td class="info" colspan=6> <?php print WEB_device_type_show; print_devtypes_select($db_link, "devtypes", $f_devtype_id, "id<3"); ?>
  19. <?php print WEB_device_show_location; print_building_select($db_link, "building_id", $f_building_id); ?></td>
  20. <td class="info" colspan=2> <input type="submit" name="apply" value="<?php echo WEB_btn_show; ?>"></td>
  21. </tr>
  22. <tr align="center">
  23. <td><b><a href=index.php?sort=device_type&order=<?php print $new_order; ?>><?php echo WEB_cell_type; ?></a></b></td>
  24. <td><b><a href=index.php?sort=device_name&order=<?php print $new_order; ?>><?php echo WEB_cell_name; ?></a></b></td>
  25. <td><b><a href=index.php?sort=ip&order=<?php print $new_order; ?>><?php echo WEB_cell_ip; ?></a></b></td>
  26. <td><b><a href=index.php?sort=device_model_id&order=<?php print $new_order; ?>><?php echo WEB_cell_host_model; ?></a></b></td>
  27. <td><b><a href=index.php?sort=building_id&order=<?php print $new_order; ?>><?php echo WEB_location_name; ?></a></b></td>
  28. <td><b><?php echo WEB_device_port_count; ?></b></td>
  29. <td><b><?php echo WEB_nagios; ?></b></td>
  30. <td><b><?php echo WEB_network_discovery; ?></b></td>
  31. </tr>
  32. <?php
  33. $filter = '';
  34. if ($f_building_id > 0) { $filter .= ' and building_id=' . $f_building_id; }
  35. if ($f_devtype_id > 0) { $filter .= ' and device_type=' . $f_devtype_id; } else { $filter .= ' and device_type<=2'; }
  36. $dSQL = 'SELECT * FROM devices WHERE deleted=0 '.$filter.' '.$sort_sql;
  37. $switches = get_records_sql($db_link,$dSQL);
  38. foreach ($switches as $row) {
  39. print "<tr align=center>\n";
  40. $cl = "data";
  41. if (isset($row['nagios_status'])) {
  42. $cl = 'shutdown';
  43. if ($row['nagios_status'] == 'UP') { $cl = 'up'; }
  44. }
  45. print "<td class=\"$cl\">".get_devtype_name($db_link,$row['device_type'])."</td>\n";
  46. print "<td class=\"$cl\" align=left><a href=editdevice.php?id=".$row['id'].">" . $row['device_name'] . "</a></td>\n";
  47. if (isset($row['user_id']) and $row['user_id']>0) {
  48. print "<td class=\"$cl\"><a href=/admin/users/edituser.php?id=".$row['user_id'].">".$row['ip']."</a></td>\n";
  49. } else {
  50. print "<td class=\"$cl\">".$row['ip']."</td>\n";
  51. }
  52. print "<td class=\"$cl\">" . get_vendor_name($db_link, $row['vendor_id']) . " " . get_device_model($db_link,$row['device_model_id']) . "</td>\n";
  53. print "<td class=\"$cl\">" . get_building($db_link, $row['building_id']) . "(" . $row['comment'] . ")</td>\n";
  54. print "<td class=\"$cl\">".$row['port_count']."</td>\n";
  55. print "<td class=\"$cl\">" . get_qa($row['nagios']) . "</td>\n";
  56. print "<td class=\"$cl\">" . get_qa($row['discovery']) . "</td>\n";
  57. }
  58. ?>
  59. </table>
  60. </form>
  61. <table class="data">
  62. <tr><td><?php echo WEB_color_device_description; ?></td></tr>
  63. <tr>
  64. <td class="shutdown"><?php echo WEB_device_down; ?></td>
  65. <td class="up"><?php echo WEB_color_device_online; ?></td>
  66. <tr>
  67. </table>
  68. <?php
  69. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  70. ?>