index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. if (cfr('SWITCHID')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. if ($altCfg['SWITCHES_EXTENDED']) {
  5. $messages = new UbillingMessageHelper();
  6. $result = wf_BackLink('?module=switches', __('Back'), true, 'ubButton');
  7. $result.=wf_tag('br');
  8. $query = "SELECT switches.modelid,switches.ip,switches.id,switches.swid,switches.location,switchmodels.id,switchmodels.modelname "
  9. . "FROM switches,switchmodels WHERE switches.modelid=switchmodels.id";
  10. $allsw = simple_queryall($query);
  11. if (!empty($allsw)) {
  12. $tablecells = wf_TableCell(__('Location'));
  13. $tablecells.=wf_TableCell(__('IP'));
  14. $tablecells.=wf_TableCell(__('Model'));
  15. $tablecells.=wf_TableCell(__('Remote ID'));
  16. $tablerows = wf_TableRow($tablecells, 'row1');
  17. foreach ($allsw as $io => $eachsw) {
  18. $swloc = $eachsw['location'];
  19. $swip = $eachsw['ip'];
  20. $swmod = $eachsw['modelname'];
  21. $swid = $eachsw['swid'];
  22. if (!empty($swid)) {
  23. $tablecells = wf_TableCell($swloc);
  24. $tablecells.=wf_TableCell($swip);
  25. $tablecells.=wf_TableCell($swmod);
  26. $tablecells.=wf_TableCell($swid);
  27. $tablerows.=wf_TableRow($tablecells, 'row5');
  28. }
  29. }
  30. $result.= wf_TableBody($tablerows, '100%', '0', 'sortable');
  31. } else {
  32. $result.= $messages->getStyledMessage(__('No switches found'), 'info');
  33. }
  34. show_window(__('Remote Switch ID Module'), $result);
  35. } else {
  36. show_error(__('This module is disabled'));
  37. }
  38. } else {
  39. show_error(__('You cant control this module'));
  40. }
  41. ?>