Changeset 767 for trunk/Modules/Notify/Notify.php
- Timestamp:
- Nov 22, 2015, 12:05:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Notify/Notify.php
r763 r767 35 35 } 36 36 37 function OnlineList($Title, $OnlineNow, $OnlinePrevious )37 function OnlineList($Title, $OnlineNow, $OnlinePrevious, $MinDuration) 38 38 { 39 39 $Time = time(); 40 $MinDuration = 5;41 40 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 42 41 $Output = ''; 42 $Condition = 'WHERE (`NetworkInterface`.`Online` = '.$OnlineNow.') AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.') '. 43 'AND (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")'; 43 44 $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '. 44 45 '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '. 45 46 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '. 46 'WHERE (`NetworkInterface`.`Online` = '.$OnlineNow.') AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.') '. 47 'AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) '. 48 'AND (`NetworkInterface`.`LastOnline` < "'.TimeToMysqlDateTime($Time - $MinDuration).'") ORDER BY `Name` ASC'); 47 $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) '. 48 'ORDER BY `Name` ASC'); 49 49 if($DbResult3->num_rows > 0) { 50 50 $Output .= $Title.'<br/>'; … … 65 65 $Output .= '</table><br/>'."\n"; 66 66 } 67 $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '. 68 $Condition); 67 69 return $Output; 68 70 } … … 83 85 { 84 86 if($Category['SysName'] == 'NetworkReachability') { 85 $List = $this->OnlineList('Nově online', 1, 0 );86 $List .= $this->OnlineList('Nově offline', 0, 1 );87 $List = $this->OnlineList('Nově online', 1, 0, 0); 88 $List .= $this->OnlineList('Nově offline', 0, 1, 5); 87 89 if($List != '') $List .= $this->OnlineList('Stále offline', 0, 0); 88 90 if($List != '') { … … 93 95 } 94 96 } 95 $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.96 'WHERE `OnlineNotify` != `Online`');97 97 $this->Database->update('NotifyUser', '`Id`='.$User['Id'], array('LastTime' => TimeToMysqlDateTime($Time))); 98 98
Note:
See TracChangeset
for help on using the changeset viewer.