Changeset 763
- Timestamp:
- Nov 5, 2015, 9:56:35 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r762 r763 1 1 <?php 2 2 3 $Revision = 76 2; // Subversion revision4 $DatabaseRevision = 76 2; // SQL structure revision3 $Revision = 763; // Subversion revision 4 $DatabaseRevision = 763; // SQL structure revision 5 5 $ReleaseTime = strtotime('2015-11-05'); -
trunk/Common/Setup/Updates.php
r762 r763 1598 1598 } 1599 1599 1600 function UpdateTo763($Manager) 1601 { 1602 $Manager->Execute('ALTER TABLE `NetworkInterface` ADD `OnlineNotify` INT NOT NULL AFTER `LastOnline`;'); 1603 $Manager->Execute('ALTER TABLE `NetworkDevice` DROP `OnlineNotify`;'); 1604 } 1600 1605 1601 1606 … … 1676 1681 755 => array('Revision' => 759, 'Function' => 'UpdateTo759'), 1677 1682 759 => array('Revision' => 762, 'Function' => 'UpdateTo762'), 1683 762 => array('Revision' => 763, 'Function' => 'UpdateTo763'), 1678 1684 )); 1679 1685 } -
trunk/Modules/Notify/Notify.php
r762 r763 37 37 function OnlineList($Title, $OnlineNow, $OnlinePrevious) 38 38 { 39 $Time = time(); 40 $MinDuration = 5; 39 41 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 40 42 $Output = ''; 41 43 $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '. 42 '`Network Device`.`Online`, `NetworkDevice`.`LastOnline` FROM `NetworkInterface` '.44 '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '. 43 45 '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 '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'); 46 49 if($DbResult3->num_rows > 0) { 47 50 $Output .= $Title.'<br/>'; 48 $Output .= '<table border="1" cellspacing="0" cellpadding="5">'.51 $Output .= '<table>'. 49 52 '<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 53 while($Item = $DbResult3->fetch_assoc()) 51 54 { 52 $Duration = MysqlDateTimeToTime($Item['LastOnline']);55 $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']); 53 56 $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'. 54 55 57 sprintf('%02d', floor($Duration / 60 % 60)).':'. 58 sprintf('%02d', floor($Duration % 60)); 56 59 $Days = floor($Duration / (60 * 60 * 24)); 57 60 if($Days > 0) $DurationText = $Days.' dnů '.$DurationText; … … 67 70 function Check() 68 71 { 69 echo('ss');70 72 $Output = ''; 71 73 $DbResult = $this->Database->query('SELECT `NotifyUser`.`Id`, `NotifyUser`.`LastTime`, `User`.`Name`, `Contact`.`Value`, `Contact`.`Category` FROM `NotifyUser` '. … … 83 85 $List = $this->OnlineList('Nově online', 1, 0); 84 86 $List .= $this->OnlineList('Nově offline', 0, 1); 85 $List .= $this->OnlineList('Stále offline', 0, 0);87 if($List != '') $List .= $this->OnlineList('Stále offline', 0, 0); 86 88 if($List != '') { 87 $Output .= ' Category'.$Category['Name'].":\n";88 $Content .= ' Category'.$Category['Name']."<br>\n";89 $Output .= 'Kategorie: '.$Category['Name'].":\n"; 90 $Content .= 'Kategorie: '.$Category['Name']."<br>\n"; 89 91 $Content .= $List; 90 92 } 91 93 } 92 94 } 93 $this->Database->query('UPDATE `Network Device` SET `OnlineNotify` = `Online` '.95 $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '. 94 96 'WHERE `OnlineNotify` != `Online`'); 95 97 $this->Database->update('NotifyUser', '`Id`='.$User['Id'], array('LastTime' => TimeToMysqlDateTime($Time))); … … 100 102 $Mail->AddTo($User['Value'], $User['Name']); 101 103 $Mail->AddBody(strip_tags($Content), 'text/plain'); 102 $Mail->AddBody($Content, 'text/html'); 104 $Mail->AddBody('<style> 105 table { border-collapse: collapse; } 106 table, th, td { border: 1px solid black; } 107 td { padding: 5px; } 108 </style>'.$Content, 'text/html'); 103 109 $Mail->Send(); 104 110 $Output .= 'Sent email to '.$User['Value'].' ('.$User['Name'].')<br/>';
Note:
See TracChangeset
for help on using the changeset viewer.