menu2.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. require_once '../auth.php';
  3. require_once 'menustring.php';
  4. $phplm_www = '';
  5. $phplm_dir = '';
  6. require_once ($phplm_dir . "lib/layersmenu-common.inc.php");
  7. require_once ($phplm_dir . "lib/layersmenu-process.inc.php");
  8. $mid = new ProcessLayersMenu();
  9. $mid->setMenuStructureString($menuString);
  10. $mid->parseStructureForMenu('treemenu1');
  11. $tmpTable = "t".date('YmdHis');
  12. $mid->setTableName($tmpTable);
  13. $sqlDump = $mid->getSQLDump('treemenu1');
  14. $sqlCreate = "CREATE TEMPORARY TABLE ".$tmpTable." ( ".
  15. " ".implode(" varchar(255), ", $mid->tableFields)." varchar(255) ".
  16. " )";
  17. //$adodb->debug = 1;
  18. $adodb->Execute($sqlCreate);
  19. $pie = explode(";", $sqlDump);
  20. foreach ($pie as $k => $v) $adodb->Execute($v);
  21. if (isset($_GET['id'])) {
  22. $rs = $adodb->Execute("SELECT * FROM ".$tmpTable.
  23. " WHERE parent_id = ? ", array($_GET['id']));
  24. header("Content-Type: text/xml");
  25. header("Cache-Control: no-cache");
  26. echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
  27. echo "<tree>\n";
  28. while (!$rs->EOF) {
  29. $rs2 = $adodb->Execute("SELECT COUNT(*) as cnt FROM ".$tmpTable.
  30. " WHERE parent_id = ? ", array($rs->fields['id']));
  31. echo "<tree ".
  32. " text=\"".htmlspecialchars($rs->fields['text'])."\" ";
  33. if ($rs2->fields['cnt']>0) {
  34. echo " src=\"".htmlspecialchars($_SERVER['PHP_SELF']."?id=".$rs->fields['id'])."\" ";
  35. }
  36. echo " action=\"".htmlspecialchars($rs->fields['href'])."\" ".
  37. " target=\"".htmlspecialchars($rs->fields['target'])."\" ".
  38. " />\n";
  39. $rs->MoveNext();
  40. }
  41. echo "</tree>\n";
  42. exit;
  43. }
  44. ?>
  45. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  46. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  47. <html>
  48. <head>
  49. <title>XLoadTree Demo (WebFX)</title>
  50. <script type="text/javascript" src="xloadtree/xtree.js"></script>
  51. <script type="text/javascript" src="xloadtree/xmlextras.js"></script>
  52. <script type="text/javascript" src="xloadtree/xloadtree.js"></script>
  53. <link type="text/css" rel="stylesheet" href="xloadtree/xtree.css" />
  54. <style type="text/css">
  55. body {
  56. background: white;
  57. color: black;
  58. }
  59. </style>
  60. </head>
  61. <body>
  62. <script type="text/javascript">
  63. /// XP Look
  64. webFXTreeConfig.rootIcon = "xloadtree/images/xp/folder.png";
  65. webFXTreeConfig.openRootIcon = "xloadtree/images/xp/openfolder.png";
  66. webFXTreeConfig.folderIcon = "xloadtree/images/xp/folder.png";
  67. webFXTreeConfig.openFolderIcon = "xloadtree/images/xp/openfolder.png";
  68. webFXTreeConfig.fileIcon = "xloadtree/images/xp/file.png";
  69. webFXTreeConfig.lMinusIcon = "xloadtree/images/xp/Lminus.png";
  70. webFXTreeConfig.lPlusIcon = "xloadtree/images/xp/Lplus.png";
  71. webFXTreeConfig.tMinusIcon = "xloadtree/images/xp/Tminus.png";
  72. webFXTreeConfig.tPlusIcon = "xloadtree/images/xp/Tplus.png";
  73. webFXTreeConfig.iIcon = "xloadtree/images/xp/I.png";
  74. webFXTreeConfig.lIcon = "xloadtree/images/xp/L.png";
  75. webFXTreeConfig.tIcon = "xloadtree/images/xp/T.png";
  76. webFXTreeConfig.errorLoadingText = "Error Loading";
  77. //var tree = new WebFXLoadTree("Root", "<?=$_SERVER['PHP_SELF']?>?id=1");
  78. var tree = new WebFXLoadTree("<?=__('Tree Menu', 'Root', 'MAIN MENU');?>", "<?=$_SERVER['PHP_SELF']?>?id=1");
  79. //tree.setBehavior("classic");
  80. document.write(tree);
  81. </script>
  82. </body>
  83. </html>