Changeset 762
- Timestamp:
- Nov 5, 2015, 9:38:59 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r761 r762 1 1 <?php 2 2 3 $Revision = 76 1; // Subversion revision4 $DatabaseRevision = 7 59; // SQL structure revision5 $ReleaseTime = strtotime('2015-1 0-26');3 $Revision = 762; // Subversion revision 4 $DatabaseRevision = 762; // SQL structure revision 5 $ReleaseTime = strtotime('2015-11-05'); -
trunk/Common/Setup/Updates.php
r761 r762 1592 1592 } 1593 1593 */ 1594 1595 function UpdateTo762($Manager) 1596 { 1597 $Manager->Execute('ALTER TABLE `NetworkDevice` ADD `OnlineNotify` INT NOT NULL AFTER `API`;'); 1598 } 1599 1600 1594 1601 1595 1602 class Updates … … 1668 1675 752 => array('Revision' => 755, 'Function' => 'UpdateTo755'), 1669 1676 755 => array('Revision' => 759, 'Function' => 'UpdateTo759'), 1677 759 => array('Revision' => 762, 'Function' => 'UpdateTo762'), 1670 1678 )); 1671 1679 } -
trunk/Modules/Notify/Notify.php
r758 r762 35 35 } 36 36 37 function OnlineList($Title, $OnlineNow, $OnlinePrevious) 38 { 39 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 40 $Output = ''; 41 $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '. 42 '`NetworkDevice`.`Online`, `NetworkDevice`.`LastOnline` FROM `NetworkInterface` '. 43 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '. 44 'WHERE (`NetworkDevice`.`Online` = '.$OnlineNow.') AND (`NetworkDevice`.`OnlineNotify` = '.$OnlinePrevious.') '. 45 'AND (`NetworkDevice`.`PermanentOnline`=1) ORDER BY `Name` DESC'); 46 if($DbResult3->num_rows > 0) { 47 $Output .= $Title.'<br/>'; 48 $Output .= '<table border="1" cellspacing="0" cellpadding="5">'. 49 '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n"; 50 while($Item = $DbResult3->fetch_assoc()) 51 { 52 $Duration = MysqlDateTimeToTime($Item['LastOnline']); 53 $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'. 54 sprintf('%02d', floor($Duration / 60 % 60)).':'. 55 sprintf('%02d', floor($Duration % 60)); 56 $Days = floor($Duration / (60 * 60 * 24)); 57 if($Days > 0) $DurationText = $Days.' dnů '.$DurationText; 58 59 $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']]. 60 '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n"; 61 } 62 $Output .= '</table><br/>'."\n"; 63 } 64 return $Output; 65 } 66 37 67 function Check() 38 68 { 39 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');69 echo('ss'); 40 70 $Output = ''; 41 71 $DbResult = $this->Database->query('SELECT `NotifyUser`.`Id`, `NotifyUser`.`LastTime`, `User`.`Name`, `Contact`.`Value`, `Contact`.`Category` FROM `NotifyUser` '. … … 51 81 { 52 82 if($Category['SysName'] == 'NetworkReachability') { 53 $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '. 54 '`NetworkInterfaceUpDown`.`State`, `NetworkInterfaceUpDown`.`Duration`, `NetworkInterfaceUpDown`.`Time` FROM `NetworkInterfaceUpDown` '. 55 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkInterfaceUpDown`.`Interface` '. 56 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '. 57 'WHERE (`Time` > "'.$User['LastTime'].'") AND (`Time` <= "'.TimeToMysqlDateTime($Time).'") '. 58 'AND (`NetworkDevice`.`PermanentOnline`=1) ORDER BY `NetworkInterfaceUpDown`.`Time` DESC'); 59 if($DbResult3->num_rows > 0) { 83 $List = $this->OnlineList('Nově online', 1, 0); 84 $List .= $this->OnlineList('Nově offline', 0, 1); 85 $List .= $this->OnlineList('Stále offline', 0, 0); 86 if($List != '') { 60 87 $Output .= 'Category '.$Category['Name'].":\n"; 61 88 $Content .= 'Category '.$Category['Name']."<br>\n"; 62 $Content .= '<table><tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n"; 63 while($Item = $DbResult3->fetch_assoc()) 64 { 65 $Duration = sprintf('%02d', floor($Item['Duration'] / 3600 % 24)).':'. 66 sprintf('%02d', floor($Item['Duration'] / 60 % 60)).':'. 67 sprintf('%02d', floor($Item['Duration'] % 60)); 68 $Days = floor($Item['Duration'] / (60 * 60 * 24)); 69 if($Days > 0) $Duration = $Days.' dnů '.$Duration; 70 71 $Content .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['State']]. 72 '</td><td>'.$Item['Time'].'</td><td>'.$Duration.'</td></tr>'."\n"; 73 } 74 $Content .= '</table>'."\n"; 89 $Content .= $List; 75 90 } 76 91 } 77 92 } 93 $this->Database->query('UPDATE `NetworkDevice` SET `OnlineNotify` = `Online` '. 94 'WHERE `OnlineNotify` != `Online`'); 78 95 $this->Database->update('NotifyUser', '`Id`='.$User['Id'], array('LastTime' => TimeToMysqlDateTime($Time))); 79 96
Note:
See TracChangeset
for help on using the changeset viewer.