This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cables-report.php
55 lines (49 loc) · 1.87 KB
/
cables-report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include ('inc/init.php');
$tabhandler['reports']['cableid'] = 'renderCableIdReport'; // register a report rendering function
$tab['reports']['cableid'] = 'Cable IDs'; // title of the report tab
function renderCableIdReport()
{
global $dbxlink;
$sql = "SELECT Link.*, porta.id as porta_id, porta.name as porta_name, objecta.id as objecta_id, objecta.name as objecta_name, portb.id as portb_id, portb.name as portb_name, objectb.id as objectb_id, objectb.name as objectb_name
FROM Link
INNER JOIN Port porta ON porta.id = Link.porta
INNER JOIN Port portb ON portb.id = Link.portb
INNER JOIN Object objecta ON porta.object_id = objecta.id
INNER JOIN Object objectb ON portb.object_id = objectb.id
WHERE Link.cable<>''
ORDER BY cable ASC";
echo '<div class="portlet">';
// display the stat array
echo "<h2>Cable IDs Report</h2>";
echo '<table cellspacing="0" cellpadding="5" align="center" class="widetable">';
echo '<tbody>';
echo '<tr><th class="tdleft">Cable Name</th><th class="tdleft">Port A ID</th><th class="tdleft">Port B ID</th></tr>';
foreach ($dbxlink->query($sql) as $row) {
echo "<tr>";
echo '<td class="tdleft"><h3>' . $row["cable"] . "</h3></td>";
// A
echo '<td class="tdleft">';
echo '<div><strong>';
echo $row["objecta_name"];
echo '</strong></div>';
echo '<div>';
echo '<a href="/index.php?page=object&tab=ports&object_id='.$row["objecta_id"].'&hl_port_id='.$row["porta_id"].'">' . $row["porta_name"] . '</a>';
echo '</div>';
echo '</td>';
// B
echo '<td class="tdleft">';
echo '<div><strong>';
echo $row["objectb_name"];
echo '</strong></div>';
echo '<div>';
echo '<a href="/index.php?page=object&tab=ports&object_id='.$row["objectb_id"].'&hl_port_id='.$row["portb_id"].'">' . $row["portb_name"] . '</a>';
echo '</div>';
echo '</td>';
echo "</tr>";
}
echo '</tbody>';
echo '</table>';
echo '</div>';
}
?>