Location: PHPKode > projects > Calia > calia/index.php
<?php

require_once 'local.inc';

function PrintMenu($menuItem)
{
  foreach($menuItem as $menuTitle=>$menuData)
    {
      print('<li>'.LibHtmlMakeLink($menuData[0], $menuTitle));
      if(is_array($menuData[1]))
	{
	  print('<ul>');
	  PrintMenu($menuData[1]);
	  print('</ul>');
	}
    }
}

DisplayStart('Calia', array(), _('Welcome to Calia'));

print('This is Calia, the Network Management System.  To begin using Calia, select a function from the menus on the left side of the screen, or use the menus below (which are identical).');

  // Build our menu.
  $horizMenu = array();
  $horizMenuTargets = array();
  
  foreach($GLOBALS['menu-data'] as $menuItem)
    {
      list($permsArray, $menuHierarchy, $targetUrl) = $menuItem;
      $horizMenuTargets[implode('|',$menuHierarchy)] = $menuItem;
    }
  ksort($horizMenuTargets);
  foreach($horizMenuTargets as $menuItem)
    {
      list($permsArray, $menuHierarchy, $targetUrl) = $menuItem;

      if( ($permsArray === NULL) || (PermsCheck($permsArray[0], $permsArray[1], $permsArray[2])) )
	{
	  if(!strpos($targetUrl, ':')) $targetUrl = $GLOBALS['BASE_URL'].$targetUrl;
	  $arrPtr = &$horizMenu;
	  foreach($menuHierarchy as $lev=>$itemName)
	    if($lev == (count($menuHierarchy) - 1))
	      $arrPtr[$itemName] = array($targetUrl, array());
	    else
	      {
		if(!isset($arrPtr[$itemName]))
		  $arrPtr[$itemName] = array('', array());
		$arrPtr = &$arrPtr[$itemName][1];
	      }
	}
    }

ksort($horizMenu);

print('<br><br><center><table class="mainmenu"><tr><td>');
$col = 0;
foreach($horizMenu as $menuTitle=>$menuArray)
{
  print("\n<table><tr><th>".LibHtmlMakeLink($menuArray[0], $menuTitle)."<tr><td><ul>");
  PrintMenu($menuArray[1]);
  print("</ul></table>\n");
  $col = abs($col - 1);
  if(!$col) print("<tr>"); 
  print("<td>");
}
print('</table></center><br>');

?>
Return current item: Calia