Location: PHPKode > projects > OpenDataCenter Network Management System > include/mainview_page/port/view.php
<?php
// ----------------------------------------------------------------------
// Copyright (C) 2007 by GREGORY LE BRAS
// ----------------------------------------------------------------------
// LICENSE
//
// This file is part of ODCNMS - Open DataCenter Network Management System
// 
// ODCNMS is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// Foobar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Foobar; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
// ----------------------------------------------------------------------
// Original Author of file: GREGORY LE BRAS - http://www.odcnms.org/
// ----------------------------------------------------------------------
?>
<?php
$request=mysql_query("SELECT * FROM $name_table_port WHERE id=\"$id\"") or die ("ERROR!");

while($tmp_request=mysql_fetch_array($request))
{
$port_name = $tmp_request['name'];
?>
<table class="subtitle" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="90%"><h4><img src="images/port.gif" alt="port" align="top"> <?php echo $tmp_request['name']; ?></h4></td>
		<td width="10%" style="text-align:right">[ <a href="index.php?include=mainview&page=port&action=edit&id=<?php echo $id; ?>"><?php echo TXT_EDIT; ?></a> ]</td>
		</td>
	<tr>
</table>
<table class="list" width="100%" cellspacing="2" cellpadding="3">
<?php
		
		$request=mysql_query("SELECT * FROM $name_table_port WHERE id=\"$id\"") or die ("ERROR!");

		while($tmp_request=mysql_fetch_array($request))
		{	
			echo "<tr class=\"list_title\">
				<td width=\"100%\" style=\"font-weight:normal;\"><b>";
			echo TXT_NAME;
			echo ":</b> $tmp_request[name]</td>
			</tr>";
			$request_patch_panel = mysql_query("SELECT id,name FROM $name_table_patch_panel WHERE id=$tmp_request[patch_panel_id]") or die ("ERROR!");
			while($tmp_request_patch_panel=mysql_fetch_array($request_patch_panel))
			{
				echo "<tr class=\"list_title\">
				<td width=\"100%\" style=\"font-weight:normal;\"><b>";
				echo TXT_PATCH_PANEL;
				echo ":</b> <a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$tmp_request_patch_panel[id]\">$tmp_request_patch_panel[name]</a></td>
				</tr>";
			}
			echo "<tr class=\"list_title\">
				<td width=\"100%\" style=\"font-weight:normal;\"><b>";
				echo TXT_DESCRIPTION;
				echo ":</b> $tmp_request[description]</td>
			</tr></table>";	
			
			$request_count_port_port=mysql_query("SELECT count(*) FROM $name_table_link_port_port WHERE port_id=\"$id\" OR port2_id=\"$id\"") or die ("ERROR!");
			$result_port_port = mysql_fetch_array($request_count_port_port);
			
			$request_count_port_interface=mysql_query("SELECT count(*) FROM $name_table_link_port_interface WHERE port_id=\"$id\"") or die ("ERROR!");
			$result_port_interface = mysql_fetch_array($request_count_port_interface);			
			
			if (($result_port_port[0]!="0") || ($result_port_interface[0]!="0"))
			{
?>
<table class="subtitle" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="100%"><h4><img src="images/link.gif" alt="Link" align="top"> <?php echo TXT_LINK_BETWEEN; ?></h4></td>
</table>
<table width="100%" cellspacing="2" cellpadding="3">
<?php
		$request=mysql_query("SELECT * FROM $name_table_link_port_port WHERE port_id=\"$id\" OR port2_id=\"$id\"") or die ("ERROR!");

		while($tmp_request=mysql_fetch_array($request))
		{	
			$request2=mysql_query("SELECT id,patch_panel_id,name FROM $name_table_port WHERE id=\"$tmp_request[port_id]\"") or die ("ERROR1!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<tr><td><img src=\"images/port.gif\" alt=\"Port\" align=\"top\"> Port number $tmp_request2[name] of patch panel";
				
				$request3=mysql_query("SELECT id,name FROM $name_table_patch_panel WHERE id=\"$tmp_request2[patch_panel_id]\"") or die ("ERROR1!");
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo " <a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a></td></tr>";
				}
			}
			
			$request2=mysql_query("SELECT id,patch_panel_id,name FROM $name_table_port WHERE id=\"$tmp_request[port2_id]\"") or die ("ERROR1!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<tr><td><img src=\"images/port.gif\" alt=\"Port\" align=\"top\"> Port number $tmp_request2[name] of patch panel";
				
				$request3=mysql_query("SELECT id,name FROM $name_table_patch_panel WHERE id=\"$tmp_request2[patch_panel_id]\"") or die ("ERROR1!");
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo " <a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a></td></tr>";
				}
			}
			echo "<tr><td>[ <a href=\"index.php?include=mainview&page=link&action=edit&what=port_port&id_port1=$tmp_request[port_id]&id_port2=$tmp_request[port2_id]\">";
			echo TXT_EDIT;
			echo "</a> ]</td></tr>";			
			echo "</table>";
		}
		
		$request=mysql_query("SELECT * FROM $name_table_link_port_interface WHERE port_id=\"$id\"") or die ("ERROR!");

		while($tmp_request=mysql_fetch_array($request))
		{	
			$request2=mysql_query("SELECT id,slot_id,name FROM $name_table_interface WHERE id=\"$tmp_request[interface_id]\"") or die ("ERROR1!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<tr><td><img src=\"images/interface.gif\" alt=\"Interface\" align=\"top\"> Interface $tmp_request2[name] of slot";
				
				$request3=mysql_query("SELECT id,name,device_id FROM $name_table_slot WHERE id=\"$tmp_request2[slot_id]\"") or die ("ERROR1!");
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo " <a href=\"index.php?include=mainview&page=slot&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a> ";
					echo "&";
					echo TXT_DEVICE;
					
					$request4=mysql_query("SELECT id,name FROM $name_table_device WHERE id=\"$tmp_request3[device_id]\"") or die ("ERROR1!");
					while($tmp_request4=mysql_fetch_array($request4))
					{
						echo " <a href=\"index.php?include=mainview&page=device&action=view&id=$tmp_request4[id]\">$tmp_request4[name]</a></td></tr>";
					}					
				}			
			}
			
			$request2=mysql_query("SELECT id,patch_panel_id,name FROM $name_table_port WHERE id=\"$id\"") or die ("ERROR1!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<tr><td><img src=\"images/port.gif\" alt=\"Port\" align=\"top\"> Port number $tmp_request2[name] of patch panel";
				
				$request3=mysql_query("SELECT id,name FROM $name_table_patch_panel WHERE id=\"$tmp_request2[patch_panel_id]\"") or die ("ERROR1!");
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo " <a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a></td></tr>";
				}
			}
			echo "<tr><td>[ <a href=\"index.php?include=mainview&page=link&action=edit&what=port_interface&id_port=$tmp_request[port_id]&id_interface=$tmp_request[interface_id]\">";
			echo TXT_EDIT;
			echo "</a> ]</td></tr>";
			echo "</table>";
		}
	}
	else
	{
?>
		<table class="subtitle" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td width="90%"><h4><img src="images/link.gif" alt="Link" align="top"> <?php echo TXT_LINK_BETWEEN; ?></h4></td>
				<td width="10%" style="text-align:right">[ <a href="index.php?include=mainview&page=link&action=add&id_port=<?php echo$tmp_request['id']; ?>"><?php echo TXT_ADD; ?> <?php echo TXT_LINK; ?></a> ]</td>
			<tr>
		</table>
<?php		
	}	
}
?>
<br><center><a href="javascript:history.go(-1);">Back</a></center>
<?php
}
?>
Return current item: OpenDataCenter Network Management System