page.plan.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. require_once(__DIR__.SLASH.'Machine.class.php');
  3. require_once(__DIR__.SLASH.'MachineApplication.class.php');
  4. global $myUser;
  5. User::check_access('host','read');
  6. ?>
  7. <div class="col-md-12">
  8. <h3>Plan d'adressage</h3>
  9. <hr/>
  10. <select id="root" class="form-control mb-2" onchange="host_plan_search()">
  11. <?php
  12. $roots = array();
  13. foreach(Machine::loadAll() as $machine){
  14. $root = explode('.',$machine->ip);
  15. if(count($root)<4) continue;
  16. array_pop($root);
  17. $root = implode('.', $root );
  18. $roots[$root] = 1;
  19. }
  20. foreach($roots as $root=>$useless): ?>
  21. <option value="<?php echo $root; ?>"><?php echo $root; ?></option>
  22. <?php endforeach; ?>
  23. </select>
  24. <table class="table table-borderless table-hover table-sm table-plan" id="table-plan">
  25. <?php
  26. for($i =0; $i<32;$i++):
  27. ?>
  28. <tr>
  29. <?php
  30. for($u = 0; $u<8;$u++):
  31. $final = ( $u * 32) +$i ;
  32. ?>
  33. <th class="bg-dark text-light text-center" style="width:20px;" ><?php echo $final; ?></th><td class="p-0" style="width:10%" data-ip="<?php echo $final; ?>"></td>
  34. <?php endfor; ?>
  35. </tr>
  36. <?php endfor; ?>
  37. </table>
  38. <template id="table-plan-template">
  39. <a href="index.php?module=host&id={{id}}" class="d-block w-100 h-100 bg-light text-center"><small><i title="{{type.label}}" class="{{type.icon}}"></i> {{label}}</small></a>
  40. </template>
  41. </div>