source: trunk/Modules/Network/HostList.php@ 519

Last change on this file since 519 was 519, checked in by chronos, 12 years ago
  • Upraveno: Přepracován systém generování horního navigačního řádků stránek. Nyní mají stránky třídy Page určenu nadřazenou stránky přes nadřazenou třídu.
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/../../Common/Global.php');
4
5class PageHostList extends Page
6{
7 var $FullTitle = 'Seznam registrovaných počítačů';
8 var $ShortTitle = 'Seznam počítačů';
9 var $ParentClass = 'PageNetwork';
10
11 function Show()
12 {
13 if(array_key_exists('admin', $_GET)) $Where = 'AND NetworkDevice.Type IN (1,4,5) ';
14 else $Where = '';
15 $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
16 $Output .= '<tr><th>Jméno počítače</th><th>IP adresa</th><th>Typ</th><th>Naposledy online</th><th>Správce</th></tr>';
17 $DbResult = $this->Database->query('SELECT NetworkDevice.*, User.Name as UserName, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN Member ON Member.Id = NetworkDevice.Member LEFT JOIN User ON Member.ResponsibleUser = User.Id LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 '.$Where.'ORDER BY NetworkDevice.Name');
18 while($Device = $DbResult->fetch_assoc())
19 {
20 if($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';
21 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE Device = '.$Device['Id']);
22 $DbRow = $DbResult2->fetch_row();
23 if($DbRow[0] == 1)
24 {
25 $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
26 $Interface = $DbResult2->fetch_assoc();
27 if($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
28 if($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
29 $InterfaceName = $Device['Name'];
30 if($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
31 $Output .= '<tr><td style="text-align: left; '.$Style.'">'.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td><td style="text-align: right;">'.$Device['UserName'].'</td></tr>';
32 } else
33 {
34 $Output .= '<tr><td colspan="2" style="text-align: left; font-weight: bold; '.$Style.'">'.$Device['Name'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td><td style="text-align: right;">'.$Device['UserName'].'</td></tr>';
35 $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
36 while($Interface = $DbResult2->fetch_assoc())
37 {
38 if($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
39 if($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
40 $InterfaceName = $Device['Name'];
41 if($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
42 $Output .= '<tr><td style="text-align: left; '.$Style.'">&nbsp;&nbsp;'.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
43 }
44 }
45 }
46 $Output .= '</table></div>';
47 return($Output);
48 }
49}
50
51?>
Note: See TracBrowser for help on using the repository browser.