Location: PHPKode > projects > XaJaQ > xajaq/include/php/menu.inc.php
<?php

/* 
	menu.inc.php is part of XaJaQ, see http://xajaq.sourceforge.net/
	
	Copyright 2005-2007 Dennis Toddenroth

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/

function collectSavedSessions($currentFile ) {
	$links = array( ); 
	foreach (getFiles("./sessions" ) as $file )
		$links[] = 
			($file == $currentFile ) 
			? "<strong>$file</strong>" 
			: "<a href=\"?LOADSESSION=".urlencode($file )."\">$file</a>";
	return implode("\n<br />\n", $links ); 
}

function collectExportLinks( ) {
	$links = array( ); 
	foreach (getFiles("./sessions" ) as $file ) 
		$links[] = "<a target=\"_NEW\" href=\"export.php?file=".urlencode($file )."\">$file</a>";
	return implode("\n<br />\n", $links ); 
}

function createMenu($menuContents ) {
	echo "<br clear=\"all\"/><div id=\"menu\">";

	$menuItems = array(
		"sql" => "inspect SQL-92-style JOIN-syntax", 
		"save-on-server" => "save this session on the server", 
		"new" => "create a new session", 
		"open" => "open a saved session", 
		"download" => "export a saved session as SVG", 
		"help" => "how does this work?", 
	);
	foreach ($menuItems as $caption => $message ) {
		$actions = array( );
		foreach ($menuItems as $captionIter => $useless )
			$actions[] = ($caption == $captionIter ) 
				? "toggleVisible('".$captionIter."_ID' )" 
				: "toggleInvisible('".$captionIter."_ID' )"; 
		echo "<img src=\"images/".$caption.".png\" alt=\"".$caption."\"". 
			" title=\"".$message."\"".
			" onclick=\"".implode("; ", $actions )."\"/>";
	}
	foreach ($menuItems as $caption => $message ) {
		echo "<div id=\"".$caption."_ID\" style=\"display:none\">";
		echo "<h3>$message</h3>";
		echo "<p>".$menuContents[$caption]."</p>";
		echo "</div>";
	}
	echo "</div>";
}

?>
Return current item: XaJaQ