File: 0.01.0a/skin/default/menu.php (View as HTML)

  1: <?php 
  2: /* -------------------------------------------------------------
  3: This file is part of FreeDESK
  4: 
  5: FreeDESK is (C) Copyright 2012 David Cutting
  6: 
  7: FreeDESK is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeDESK is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeDESK.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freedesk/
 21: -------------------------------------------------------------- */
 22: /*
 23: <div id="page_menu" class="page_menu">
 24: <ul id="menu">
 25:  <li><a href="#" onclick="DESK.displayMain(true);">Home</a></li>
 26:  <li><a href="#">Pages</a>
 27:  <ul>
 28:   <li><a href="#" onclick="DESK.loadSubpage('debug');">Debug</a></li>
 29:   <li><a href="#">A.N.Other</a></li>
 30:   <li><a href="#">A.N.Other</a></li>
 31:   <li><a href="#">A.N.Other</a></li>
 32:   </ul></li>
 33: </ul>
 34: </div>
 35: <br />
 36: */
 37: function MenuOptionPrint($menuitem,$close=true)
 38: {
 39: 	echo "<li><a href=\"".$menuitem->link."\"";
 40: 	if ($menuitem->onclick != "")
 41: 	{
 42: 		echo " onclick=\"".$menuitem->onclick."\"";
 43: 	}
 44: 	echo ">";
 45: 	echo $menuitem->display;
 46: 	echo "</a>";
 47: 	if ($close)
 48: 		echo "</li>";
 49: 	echo "\n";
 50: }
 51: 
 52: global $DESK;
 53: $items = $DESK->ContextManager->MenuItems();
 54: if ($items===false)
 55: {
 56: 	// nothing here
 57: }
 58: else
 59: {
 60: 	echo "<div id=\"page_menu\" class=\"page_menu\">\n";
 61: 	echo "<ul id=\"menu\">";
 62: 	foreach($items as $item)
 63: 	{
 64: 		if (is_array($item->submenu) && (sizeof($item->submenu)>0))
 65: 		{
 66: 			MenuOptionPrint($item, false);
 67: 			echo "<ul>\n";
 68: 			foreach($item->submenu as $subitem)
 69: 				MenuOptionPrint($subitem);
 70: 			echo "</ul>\n";
 71: 			echo "</li>\n";
 72: 		}
 73: 		else
 74: 		{
 75: 			MenuOptionPrint($item);
 76: 		}
 77: 	}
 78: 	echo "</ul>\n";
 79: 	echo "</div>\n";
 80: }
 81: ?>
 82: