Source for file menu.php

Documentation is available at menu.php

  1. <?php
  2.  
  3. /*
  4. Program E related AIML knowledgebase tools
  5. Copyright 2004, Anne Kootstra [anne@aiml.info]
  6. http://www.AIML.info
  7. Program E 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 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. Program E 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 Program E; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. require_once "../admin/botloaderfuncs.php";
  22. require_once "include/menu.inc.php";
  23.  
  24. require_once "include/common.inc.php";
  25.  
  26.  
  27. getRequest("pat_id", 0);
  28. getRequest("word_path", 0);
  29. getRequest("botid", 0);
  30. getRequest("pid", 0);
  31.  
  32. $word_path = "a";
  33. //$botid = 1;
  34. // routine to create the bot selection list.
  35.  
  36. $botnames = getbotnames();
  37.  
  38. while(list($key, $val) = each($botnames)) {
  39. if($botid == $key){
  40. $bots .= "<option value=\"$key\" selected>$val</option>";
  41. }else{
  42. $bots .= "<option value=\"$key\">$val</option>";
  43. }
  44. }
  45.  
  46.  
  47. // auto select a previously selected bot.
  48. if(!$botid) {
  49.  
  50. $page['{{bots}}'] = $bots;
  51. echo useTemplate('botselect',$page);
  52.  
  53. return;
  54.  
  55. }
  56.  
  57.  
  58. if (!$pid) {
  59. $pid = 1;
  60. }
  61.  
  62. //$result2 = getNode('I am your', '1', $pid);
  63. //$result = getFirstWords($word_path, $botid, $pid);
  64.  
  65. $result = getFirstWords($word_path, $botid, $pid);
  66.  
  67. $resultTable .= "<table>\n";
  68. $resultTable .= "<tr>\n";
  69. $resultTable .= "<td colspan=\"2\">word</td>\n";
  70. $resultTable .= "<td>isend</td>\n";
  71. $resultTable .= "<td>no. nodes</td>\n";
  72. $resultTable .= "<td>template ID</td>\n";
  73. $resultTable .= "<td>max words</td>\n";
  74. $resultTable .= "<td>word</td>\n";
  75. $resultTable .= "<tr>\n";
  76.  
  77. while(list($key, $val) = each($result)) {
  78. $sub = 0;
  79. $crap['{{WORD}}'] = strtolower($val);
  80. $crap['{{SUB}}'] = strtolower($val);
  81. $resultTable .= useTemplate('menu.mainnode',$crap);
  82.  
  83. $fred = $word_path." ".$val;
  84. $result2 = getNode($val, $botid, $pid);
  85. if(is_array($result2)) {
  86. while(list($key2, $val2) = each($result2)) {
  87.  
  88. $crap['{{SUB}}'] = strtolower($val)."-".$sub;
  89. $crap['{{NODE}}'] = strtolower($val2['word']);
  90. $crap['{{ISEND}}'] = $val2['isend'];
  91. $crap['{{NO_NODES}}'] = $val2['no_nodes'];
  92. $crap['{{TEMPLATE_ID}}'] = $val2['template_id'];
  93. $crap['{{MAX_WORDS}}'] = $val2['max_words'];
  94. $resultTable .= useTemplate('menu.subnode',$crap);
  95. $sub++;
  96.  
  97.  
  98.  
  99. }
  100. }
  101. }
  102.  
  103. $resultTable .= "</table>";
  104.  
  105. $word_table['{{botid}}'] = $botid;
  106. $word_table['{{botname}}'] = getBotName($botid);
  107. $word_table['{{word_path}}'] = $word_path."<br>" ;
  108. $word_table['{{pid}}'] = $pid;
  109. $word_table['{{wordtable}}'] = $resultTable;
  110.  
  111. echo useTemplate('menu',$word_table);
  112.  
  113.  
  114. ?>

Documentation generated on Tue, 11 Jan 2005 18:41:08 +0100 by phpDocumentor 1.3.0RC3