1 | <?php
|
---|
2 | include_once('../style.php');
|
---|
3 | ShowHeader('Výkonc bezdrátových zařízení', 'Vyzářený výkon');
|
---|
4 |
|
---|
5 | //include_once('../html/is/error.php');
|
---|
6 |
|
---|
7 | //ini_set('error_reporting', E_ALL);
|
---|
8 | //ini_set('display_errors', true);
|
---|
9 | //ini_set('display_startup_errors', true);
|
---|
10 |
|
---|
11 | function DbById($Id)
|
---|
12 | {
|
---|
13 | global $Database;
|
---|
14 | $DbResult = $Database->select('wlan_db', '*', 'id='.$Id);
|
---|
15 | $Row = $DbResult->fetch_array();
|
---|
16 | return($Row);
|
---|
17 | }
|
---|
18 |
|
---|
19 | $Polozky = array('device', 'connector1', 'cable', 'connector2', 'antena');
|
---|
20 |
|
---|
21 | echo('<table width="100%"><tr><td valign="top">');
|
---|
22 | echo('<table cellspacing="0" cellpadding="3" border="1"><tr><th>Označení</th><th>Výkon [dB]</th><th>Výkon [mW]</tr>');
|
---|
23 | $DbResult = $Database->select('wlan_list', 'id,cable_length,name,'.implode(',', $Polozky));
|
---|
24 | while($Row = $DbResult->fetch_array())
|
---|
25 | {
|
---|
26 | foreach($Polozky as $Item)
|
---|
27 | {
|
---|
28 | $Row2 = DbById($Row[$Item]);
|
---|
29 | $Row[$Item.'_db'] = $Row2['value'];
|
---|
30 | $Row[$Item] = $Row2['name'];
|
---|
31 | }
|
---|
32 | $Row['cable_db'] = $Row['cable_db'] * $Row['cable_length'];
|
---|
33 | $Row['cable'] = $Row['cable'].' '.$Row['cable_length'].' m';
|
---|
34 |
|
---|
35 | $Total = 0;
|
---|
36 | foreach($Polozky as $Item)
|
---|
37 | {
|
---|
38 | $Total = $Total + $Row[$Item.'_db'];
|
---|
39 | }
|
---|
40 | echo('<tr><td>'.$Row['name'].'</td><td>'.round($Total).'</td><td>'.round(pow(10, $Total/10)).'</td></tr>');
|
---|
41 | echo('<tr><td colspan="3"><table style="font-size: smaller;" width="100%" cellspacing="0" cellpadding="3" border="1">');
|
---|
42 | foreach($Polozky as $Item)
|
---|
43 | {
|
---|
44 | echo('<tr><td>'.$Row[$Item].'</td><td>'.$Row[$Item.'_db'].'</td></tr>');
|
---|
45 | }
|
---|
46 | echo('</table></td></tr>');
|
---|
47 |
|
---|
48 | $Database->update('wlan_list', 'id='.$Row['id'], array('total' => $Total, 'total_passive' => ($Total-$Row['device_db'])));
|
---|
49 | }
|
---|
50 | echo('</table>');
|
---|
51 |
|
---|
52 | echo('</td><td valign="top">');
|
---|
53 |
|
---|
54 | echo('<table cellspacing="0" cellpadding="3" border="1">
|
---|
55 | <tr><th>Bod 1</th><th>Bod 2</th><th>Signál [dB]</tr>');
|
---|
56 | $DbResult = $Database->select('wlan_links', '*');
|
---|
57 | while($Row = $DbResult->fetch_array())
|
---|
58 | {
|
---|
59 | $DbResult2 = $Database->select('wlan_list', '*', 'id='.$Row['point1']);
|
---|
60 | $Point1 = $DbResult2->fetch_array();
|
---|
61 | $DbResult2 = $Database->select('wlan_list', '*', 'id='.$Row['point2']);
|
---|
62 | $Point2 = $DbResult2->fetch_array();
|
---|
63 |
|
---|
64 | $UtlumTrasy = -round(40 + 20*log10($Row['distance']));
|
---|
65 | $Signal = $Point1['total'] + $UtlumTrasy + $Point2['total_passive'];
|
---|
66 | echo('<tr><td>'.$Point1['name'].'</td><td>'.$Point2['name'].'</td><td>'.$Signal.'</td></tr>');
|
---|
67 | echo('<tr><td colspan="3"><table style="font-size: smaller;" width="100%" cellspacing="0" cellpadding="3" border="1">');
|
---|
68 |
|
---|
69 | echo('<tr><td>Vyzářený výkon</td><td>'.$Point1['total'].'</td></tr>');
|
---|
70 | echo('<tr><td>Útlum trasy</td><td>'.$UtlumTrasy.'</td></tr>');
|
---|
71 | echo('<tr><td>Zisk příjímače</td><td>'.$Point2['total_passive'].'</td></tr>');
|
---|
72 |
|
---|
73 | echo('</table></td></tr>');
|
---|
74 | }
|
---|
75 |
|
---|
76 | echo('</td></tr></table>');
|
---|
77 |
|
---|
78 | ?>
|
---|