Location: PHPKode > projects > OpenDataCenter Network Management System > include/mainview.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/
// ----------------------------------------------------------------------


$requestcountlocation=mysql_query("SELECT count(*) FROM $name_table_location") or die ("ERROR!");
$all_location = mysql_fetch_array($requestcountlocation);

$requestcountrack=mysql_query("SELECT count(*) FROM $name_table_rack") or die ("ERROR!");
$all_rack = mysql_fetch_array($requestcountrack);

$requestcountpatchpanel=mysql_query("SELECT count(*) FROM $name_table_patch_panel") or die ("ERROR!");
$all_patch_panel = mysql_fetch_array($requestcountpatchpanel);

$requestcountport=mysql_query("SELECT count(*) FROM $name_table_port") or die ("ERROR!");
$all_port = mysql_fetch_array($requestcountport);

$requestcountcustomer=mysql_query("SELECT count(*) FROM $name_table_customer") or die ("ERROR!");
$all_customer = mysql_fetch_array($requestcountcustomer);

$requestcountnetwork=mysql_query("SELECT count(*) FROM $name_table_network") or die ("ERROR!");
$all_network = mysql_fetch_array($requestcountnetwork);

$requestcountsubnet=mysql_query("SELECT count(*) FROM $name_table_subnet") or die ("ERROR!");
$all_subnet = mysql_fetch_array($requestcountsubnet);

$requestcountipaddress=mysql_query("SELECT count(*) FROM $name_table_ip_address") or die ("ERROR!");
$all_ip_address = mysql_fetch_array($requestcountipaddress);

$requestcountvlan=mysql_query("SELECT count(*) FROM $name_table_vlan") or die ("ERROR!");
$all_vlan = mysql_fetch_array($requestcountvlan);

$requestcountmanufacturer=mysql_query("SELECT count(*) FROM $name_table_manufacturer") or die ("ERROR!");
$all_manufacturer = mysql_fetch_array($requestcountmanufacturer);

$requestcountcategory=mysql_query("SELECT count(*) FROM $name_table_category") or die ("ERROR!");
$all_category = mysql_fetch_array($requestcountcategory);

$requestcountmodel=mysql_query("SELECT count(*) FROM $name_table_model") or die ("ERROR!");
$all_model = mysql_fetch_array($requestcountmodel);

$requestcountdevice=mysql_query("SELECT count(*) FROM $name_table_device") or die ("ERROR!");
$all_device = mysql_fetch_array($requestcountdevice);

$requestcountslot=mysql_query("SELECT count(*) FROM $name_table_slot") or die ("ERROR!");
$all_slot = mysql_fetch_array($requestcountslot);

$requestcountinterface=mysql_query("SELECT count(*) FROM $name_table_interface") or die ("ERROR!");
$all_interface = mysql_fetch_array($requestcountinterface);

  // Control dynamic style sheet
  $styleBodyIndent=true;
  $styleBodyBGcolor="#ededed";

  if (file_exists( 'TreeMenuXL.php' ))
    include_once( 'TreeMenuXL.php' );
  else 
    include_once( $_SERVER['DOCUMENT_ROOT'] . '/bin/TreeMenuXL.php' );

  // Menu00 -- Based on the original example
  // Should be as basic as possible.
	$menu00  = new HTML_TreeMenuXL();
	
	$node0 = new HTML_TreeNodeXL(" ".TXT_LOCATION." (".$all_location[0].")", "index.php?include=mainview&page=location", array("icon"=>"location.gif"));
	$nx = &$node0->
		addItem(new HTML_TreeNodeXL(" ".TXT_RACK." (".$all_rack[0].")", "index.php?include=mainview&page=rack", array("icon"=>"rack.gif")));
		$nx = &$nx->
			addItem(new HTML_TreeNodeXL(" ".TXT_PATCH_PANEL." (".$all_patch_panel[0].")", "index.php?include=mainview&page=patch_panel", array("icon"=>"patch_panel.gif")));
		$nx = &$nx->
			addItem(new HTML_TreeNodeXL(" ".TXT_PORT." (".$all_port[0].")", "index.php?include=mainview&page=port", array("icon"=>"port.gif")));

	$node1 = new HTML_TreeNodeXL(" ".TXT_CUSTOMER." (".$all_customer[0].")", "index.php?include=mainview&page=customer", array("icon"=>"customer.gif"));
	
	$node2 = new HTML_TreeNodeXL(" ".TXT_NETWORK." (".$all_network[0].")", "index.php?include=mainview&page=network", array("icon"=>"network.gif"));
	$nx = &$node2->
		addItem(new HTML_TreeNodeXL(" ".TXT_SUBNET." (".$all_subnet[0].")", "index.php?include=mainview&page=subnet", array("icon"=>"subnetwork.gif")));  
		$nx = &$nx->
			addItem(new HTML_TreeNodeXL(" ".TXT_IP_ADDRESS." (".$all_ip_address[0].")", "index.php?include=mainview&page=ip_address", array("icon"=>"ipaddress.gif"))); 
			
	$nx = &$node2->
		addItem(new HTML_TreeNodeXL(" ".TXT_VLAN." (".$all_vlan[0].")", "index.php?include=mainview&page=vlan", array("icon"=>"vlan.gif")));  
  
	$node3 = new HTML_TreeNodeXL(" ".TXT_MANUFACTURER." (".$all_manufacturer[0].")", "index.php?include=mainview&page=manufacturer", array("icon"=>"manufacturer.gif"));
		$nx = &$node3->
		addItem(new HTML_TreeNodeXL(" ".TXT_CATEGORY." (".$all_category[0].")", "index.php?include=mainview&page=category", array("icon"=>"category.gif")));  		
		$nx = &$nx->
			addItem(new HTML_TreeNodeXL(" ".TXT_MODEL." (".$all_model[0].")", "index.php?include=mainview&page=model", array("icon"=>"model.gif")));
  
	$node4 = new HTML_TreeNodeXL(" ".TXT_DEVICE." (".$all_device[0].")", "index.php?include=mainview&page=device", array("icon"=>"device.gif"));
	$nx = &$node4->
		addItem(new HTML_TreeNodeXL(" ".TXT_SLOT." (".$all_slot[0].")", "index.php?include=mainview&page=slot", array("icon"=>"slot.gif")));  
		$nx = &$nx->
			addItem(new HTML_TreeNodeXL(" ".TXT_INTERFACE." (".$all_interface[0].")", "index.php?include=mainview&page=interface", array("icon"=>"interface.gif")));			
  
	$menu00->addItem($node0);
	$menu00->addItem($node1);
	$menu00->addItem($node2);  
	$menu00->addItem($node3);  
	$menu00->addItem($node4);  
?>
<table id="configurationcontainer" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td id="configurationmenu">
			<?php 
			$current_url='index.php?'.$_SERVER['QUERY_STRING'];
			$current_url=str_replace ("&action=add","",$current_url);
			if (!empty($network_ident2))
			{
				$current_url=str_replace ("&action=manually_add&network_ident2=$network_ident2","",$current_url);
			}
			$current_url=str_replace ("&action=manually_add","",$current_url);
			$current_url=str_replace ("&action=manually_add&add=ok","",$current_url);
			if (!empty($network_ident))
			{
				$current_url=str_replace ("&action=automatically_add&network_ident=$network_ident","",$current_url);
			}			
			$current_url=str_replace ("&action=automatically_add","",$current_url);
			$current_url=str_replace ("&action=automatically_add&add=ok","",$current_url);
			$current_url=str_replace ("&action=add&add=ok","",$current_url);
			$current_url=str_replace ("&action=edit&edit=ok","",$current_url);
			$current_url=str_replace ("&action=delete&delete=ok","",$current_url);
			if (!empty($id))
			{
				$current_url=str_replace ("&action=add&id=$id","",$current_url);
				$current_url=str_replace ("&action=view&id=$id","",$current_url);
				$current_url=str_replace ("&action=edit&id=$id","",$current_url);
				$current_url=str_replace ("&action=delete&id=$id","",$current_url);
			}
			$example010 = &new HTML_TreeMenu_DHTMLXL($menu00, array("images"=>"images","linkSelectKey"=>$current_url));
			$example010->printMenu();
			?>
		</td>
		<td id="configurationcontent">
		<?php if (empty($page)) $page = "mainpage"; if (strlen($page) > 50) $page = "pagenotfound"; else if (!file_exists("include/mainview_page/".$page.".php")) $page = "pagenotfound"; include("include/mainview_page/".$page.".php"); ?>	
		</td>
	</tr>
</table>
Return current item: OpenDataCenter Network Management System