index.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".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_devtypes_select($db_link, "devtypes", $f_devtype_id, "id<3"); ?>
  19. Показать оборудование из <?php print_building_select($db_link, "building_id", $f_building_id); ?></td>
  20. <td class="info" colspan=2> <input type="submit" name="apply" value="Показать"></td>
  21. </tr>
  22. <tr align="center">
  23. <td><b><a href=index.php?sort=device_type&order=<?php print $new_order; ?>>Тип</a></b></td>
  24. <td><b><a href=index.php?sort=device_name&order=<?php print $new_order; ?>>Название</a></b></td>
  25. <td><b><a href=index.php?sort=ip&order=<?php print $new_order; ?>>IP</a></b></td>
  26. <td><b><a href=index.php?sort=device_model_id&order=<?php print $new_order; ?>>Модель</a></b></td>
  27. <td><b><a href=index.php?sort=building_id&order=<?php print $new_order; ?>>Расположен</a></b></td>
  28. <td><b>Портов</b></td>
  29. <td><b>Nagios</b></td>
  30. <td><b>Discavery</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>
  63. <td>Device status</td>
  64. </tr>
  65. <tr>
  66. <td class="shutdown">Down</td>
  67. <td class="up">Online</td>
  68. <tr>
  69. </table>
  70. <?php
  71. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  72. ?>