Location: PHPKode > projects > T-77.com Operational Management System > omis/menu.php
<?php require_once('Connections/t77_connect.php'); ?>
<?php
mysql_select_db($database_t77_connect, $t77_connect);
$query_bill_types = "SELECT * FROM t77_bill_types ORDER BY t77_bill_types.bill_type";
$bill_types = mysql_query($query_bill_types, $t77_connect) or die(mysql_error());
$row_bill_types = mysql_fetch_assoc($bill_types);
$totalRows_bill_types = mysql_num_rows($bill_types);
?>
<?
mysql_select_db($database_t77_connect, $t77_connect);
$query_companies_contacts = "SELECT * FROM t77_bill_companies";
$companies_contacts = mysql_query($query_companies_contacts, $t77_connect) or die(mysql_error());
$row_companies_contacts = mysql_fetch_assoc($companies_contacts);
$totalRows_companies_contacts = mysql_num_rows($companies_contacts);
?>
<?php
//initialize the session
session_start();

// ** Logout the current user. **
$logoutAction = $HTTP_SERVER_VARS['PHP_SELF']."?doLogout=true";
if ((isset($HTTP_SERVER_VARS['QUERY_STRING'])) && ($HTTP_SERVER_VARS['QUERY_STRING'] != "")){
  $logoutAction .="&". $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_GET_VARS['doLogout'])) &&($HTTP_GET_VARS['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  session_unregister('MM_Username');
  session_unregister('MM_UserGroup');
	
  $logoutGoTo = "fail.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
  }
}
?>
<?php
  // Chip's HTML_TreeMenu Information Page
  
  // Revision History
	// 2002-12-02 cchapin  Release XL2.0.2
	// 2002-11-15 cchapin  Fix PHP short tag in document template.
	// 2002-11-14 cchapin  Major update for release 1.1.0/XL2.0
  // 2002-11-02 cchapin  Revised to use HTML_TreeMenuXL class
  // 2002-11-02 cchapin  Initial release (XL1.0)
  // 2002-10-30 cchapin  Initial Creation
  
// +-----------------------------------------------------------------------+
// | Copyright (c) 2002 Chip Chapin <hide@address.com>               |
// |                    http://www.chipchapin.com                          |
// | All rights reserved.                                                  |
// |                                                                       |
// | Redistribution and use in source and binary forms, with or without    |
// | modification, are permitted provided that the following conditions    |
// | are met:                                                              |
// |                                                                       |
// | o Redistributions of source code must retain the above copyright      |
// |   notice, this list of conditions and the following disclaimer.       |
// | o Redistributions in binary form must reproduce the above copyright   |
// |   notice, this list of conditions and the following disclaimer in the |
// |   documentation and/or other materials provided with the distribution.| 
// | o The names of the authors may not be used to endorse or promote      |
// |   products derived from this software without specific prior written  |
// |   permission.                                                         |
// |                                                                       |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
// |                                                                       |
// +-----------------------------------------------------------------------+
// | Author: Chip Chapin <hide@address.com>                          |
// +-----------------------------------------------------------------------+
?>
<?
  $pgEmailSubj = 'HTML_TreeMenu_Page';

  // Control dynamic style sheet
  $styleBodyIndent=true;
  $styleBodyBGcolor="#FFDBB7";
  include_once('menu/TreeMenuXL.php');

  $menu01  = new HTML_TreeMenuXL();
  $nodeProperties = array("icon"=>"folder.gif");


// start the dynamic menu

	$i = 0;

// start with the first level based on the doctypes

	do {
	$i++;
	
		$node{$i} = new HTML_TreeNodeXL($row_bill_types['type_description'], "doc_list.php?typeID=" . $row_bill_types['bill_type'], $nodeProperties);
		
			// construct the company list
			mysql_select_db($database_t77_connect, $t77_connect);
			$query_companies_def = "SELECT * FROM t77_bill_companies, t77_bill_contacts WHERE t77_bill_contacts.contact_company_name = t77_bill_companies.company_id ORDER BY t77_bill_companies.company_name";
			$companies_def = mysql_query($query_companies_def, $t77_connect) or die(mysql_error());
			$row_companies_def = mysql_fetch_assoc($companies_def);
			$totalRows_companies_def = mysql_num_rows($companies_def);
		
			do {
			
			$checkvar = $row_companies_def['company_id'];
			$checkbilltype = $row_bill_types['bill_type'];
			
			$colname2_checkset = "0";
			if (isset($checkbilltype)) {
			  $colname2_checkset = (get_magic_quotes_gpc()) ? $checkbilltype : addslashes($checkbilltype);
			}
			$colname_checkset = "0";
			if (isset($checkvar)) {
			  $colname_checkset = (get_magic_quotes_gpc()) ? $checkvar : addslashes($checkvar);
			}
			mysql_select_db($database_t77_connect, $t77_connect);
			$query_checkset = sprintf("SELECT * FROM t77_bill_bills, t77_bill_contacts WHERE t77_bill_contacts.contact_id = t77_bill_bills.bill_contact AND t77_bill_contacts.contact_company_name = %s AND t77_bill_bills.bill_type = %s", $colname_checkset,$colname2_checkset);
			$checkset = mysql_query($query_checkset, $t77_connect) or die(mysql_error());
			$row_checkset = mysql_fetch_assoc($checkset);
			$totalRows_checkset = mysql_num_rows($checkset);
			
			if($totalRows_checkset > 0) {
			
			$nx = &$node{$i}->
					addItem(new HTML_TreeNodeXL($row_companies_def['company_name']. " / " . $row_companies_def['contact_person'], "doc_list.php?typeID=" . $row_bill_types['bill_type'] . "&conID=" . $row_companies_def['contact_id'], $nodeProperties));
					
					// and finally construct the docs
					
							$colname_docs_def = $row_bill_types['bill_type'];
							if (isset($row_bill_types['bill_type'])) {
							  $colname_docs_def = (get_magic_quotes_gpc()) ? $row_bill_types['bill_type'] : addslashes($row_bill_types['bill_type']);
							}
							$colname2_docs_def = $row_companies_def['contact_id'];
							if (isset($row_companies_def['contact_id'])) {
							  $colname2_docs_def = (get_magic_quotes_gpc()) ? $row_companies_def['contact_id'] : addslashes($row_companies_def['contact_id']);
							}
							mysql_select_db($database_t77_connect, $t77_connect);
							$query_docs_def = sprintf("SELECT * FROM t77_bill_bills WHERE t77_bill_bills.bill_type = %s AND t77_bill_bills.bill_contact = %s ORDER BY t77_bill_bills.order_number", $colname_docs_def, $colname2_docs_def);
							$docs_def = mysql_query($query_docs_def, $t77_connect) or die(mysql_error());
							$row_docs_def = mysql_fetch_assoc($docs_def);
							$totalRows_docs_def = mysql_num_rows($docs_def);
					
					if($totalRows_docs_def > 0) {
					
						do {
							
							$nx->
     							addItem(new HTML_TreeNodeXL($row_docs_def['order_number'] . " - " . $row_docs_def['bill_name'], "items.php?id=".$row_docs_def['bill_id'], $nodeProperties));
					
					
					
						} while ($row_docs_def = mysql_fetch_assoc($docs_def));
						
					}
					
					mysql_free_result($docs_def);
				
				}
					
			} while ($row_companies_def = mysql_fetch_assoc($companies_def));
			
			mysql_free_result($companies_def);
		
		$menu01->addItem($node{$i});
	} while ($row_bill_types = mysql_fetch_assoc($bill_types));
 ?>
<? 
  
  	// add another node for the contacts.
	$i++;
	$node{$i} = new HTML_TreeNodeXL("Contacts", "contacts.php", $nodeProperties);

	// loop through the comapnies
	do {
	
		$nx = &$node{$i}->
    		addItem(new HTML_TreeNodeXL($row_companies_contacts['company_name'], "contacts.php?comID=" . $row_companies_contacts['company_id'], $nodeProperties));
		
	} while ($row_companies_contacts = mysql_fetch_assoc($companies_contacts));
	
	$menu01->addItem($node{$i});

	$i++;
	$node{$i} = new HTML_TreeNodeXL("<u>Configuration</u>", "", $nodeProperties);
		$nx = &$node{$i}->
				addItem(new HTML_TreeNodeXL("Settings",  "settings.php", $nodeProperties));
		$nx = &$node{$i}->
				addItem(new HTML_TreeNodeXL("Companies",  "companies.php", $nodeProperties));
		$nx = &$node{$i}->
				addItem(new HTML_TreeNodeXL("Document types",  "doc_types.php", $nodeProperties));
	
	$menu01->addItem($node{$i});
	
	$i++;
	$node{$i} = new HTML_TreeNodeXL("<u>Reports</u>", "", $nodeProperties);
		$nx = &$node{$i}->
				addItem(new HTML_TreeNodeXL("Company/month", "report.php", $nodeProperties));
		$nx = &$node{$i}->
				addItem(new HTML_TreeNodeXL("cumulative/month", "report_cum.php", $nodeProperties));
	$menu01->addItem($node{$i});
	if($security == 'yes') {
		$menu01->addItem(new HTML_TreeNodeXL("Log out",  $logoutAction, $nodeProperties));
	}
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script src="menu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>
<style type="text/css">
<!--
.tmenu0text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	vertical-align: text-bottom;
	color: #000033;
}
.tmenu1text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	vertical-align: text-bottom;
	color: #000033;
}
.tmenu2text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	vertical-align: middle;
	color: #000033;
}
.tmenu3text {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  color: #000033;
}
*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link 
  { text-decoration:underline; color:#003ca5 }
*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited 
  { text-decoration:underline; color:#003ca5 }
*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active 
  { text-decoration:none; color:#003ca5 }
*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover 
  { text-decoration:underline; color:#ff0000 }

.tmlistbox {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-size-adjust: 0.58; /* Verdana */
  margin-bottom: 0px;
}

.tmenuSelected { 
  background-color: yellow;
}
*.tmenuSelected A:link    { text-decoration:none; color:#2020ff }
*.tmenuSelected A:visited { text-decoration:none; color:#2020ff }
*.tmenuSelected A:active  { text-decoration:none; color:#ff2020 }
*.tmenuSelected A:hover   { text-decoration:underline; color:#FF0000 }
-->
</style>
<style type="text/css">
<!--
.tableBack {
	background-image:  url(images/back.gif);
	background-repeat: repeat-y;
	border-right-width: 1px;
	border-right-style: solid;
	border-right-color: #003CA5;
}

-->
</style>
</head>

<body leftmargin="20" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top">
        <?php 
        // Create the presentation object
        $example010 = &new HTML_TreeMenu_DHTMLXL($menu01, array("images"=>"menu/TMimages", "defaultClass"=>"auto"));
        $example010->printMenu();
      ?>
    </td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($bill_types);
mysql_free_result($checkset);
mysql_free_result($companies_contacts);
?>
Return current item: T-77.com Operational Management System