Documentation is available at menu.php
- <?php
- /**
- * Main menu of the web interface
- *
- * Allows user to navigate between menus and choose commands.
- * @package Phone2Dev
- * @author Stanislav Miroshnikov
- * @todo add template support
- */
- //start a session
- session_start();
- ?>
- <html>
- <head>
- <title>Phone2Dev: Main Menu</title>
- </head>
- <body>
- <?php
- // check if the required session variables are set
- if(isset($_SESSION['intUserId']) && isset($_SESSION['intMainMenuId'])) {
- //if the menuId is not supplied display the user's main menu
- $intMenuId = -1;
- if(!isset($_GET['menuId'])) {
- $intMenuId = $_SESSION['intMainMenuId'];
- } else {
- $intMenuId = $_GET['menuId'];
- }
- /**
- * Requires Phone2Dev class for database access.
- */
- require_once 'phone2dev.php';
- $objP2D =& new Phone2Dev();
- // connect to the database
- $objP2D->dbConnect();
- // output the page header
- print "<h1>Phone2Dev: Main Menu</h1>";
- print "<p>You are logged in as: ".$_SESSION['strUsername']."</p>";
- // display sub menus for the menu
- $arrSubMenus = &$objP2D->getSubMenus($intMenuId, $_SESSION['intUserId']);
- reset($arrSubMenus);
- while (list($intSubMenuId, $strSubMenuName) = each($arrSubMenus)) {
- if($intSubMenuId != $intMenuId) {
- print "<p><a href=\"menu.php?menuId=".$intSubMenuId
- ."\">Go to: ".$strSubMenuName."<a\></p>";
- }
- }
- // display commands for the menu
- $arrCommands =& $objP2D->getCommands($intMenuId, $_SESSION['intUserId']);
- while (list($intComId, $arrComInfo) = each($arrCommands)) {
- print "<p><a href=\"command.php?menuId=".$intMenuId
- ."&commandId=".$intComId
- ."&deviceId=".$arrComInfo['intDeviceId']."\">"
- .$arrComInfo['strDeviceName'].": ".$arrComInfo['strComName']."<a\></p>";
- }
- // if this is not the main menu give option to return to main menu
- if($intMenuId != $_SESSION['intMainMenuId']) {
- print "<p>Return to <a href=\"menu.php?menuId="
- .$_SESSION['intMainMenuId']."\">Main Menu<a\></p>";
- }
- // give option to log out
- print "<p>Click here to <a href=\"logout.php\">logout</a>.</p>";
- // disconnect from the database
- $objP2D->dbDisconnect();
- } else {
- print "<h1>Phone2Dev Error</h1>";
- print "<p>You are not properly logged in.</p>";
- print "<p>You can login <a href=\"login.html\">here</a>.</p>";
- }
- ?>
- </body>
- </html>
Documentation generated on Tue, 4 Jan 2005 13:48:00 -0500 by phpDocumentor 1.3.0RC3