HTML_QuickForm_LiveText
[ class tree: HTML_QuickForm_LiveText ] [ index: HTML_QuickForm_LiveText ] [ all elements ]

Source for file auto_server2.php

Documentation is available at auto_server2.php

  1. <?php
  2. // include the server class
  3. include 'HTML/AJAX/Server.php';
  4.  
  5. // extend HTML_AJAX_Server creating our own custom one with init{ClassName} methods for each class it supports calls on
  6. class LiveText2 extends HTML_AJAX_Server {
  7. // this flag must be set to on init methods
  8. var $initMethods = true;
  9.  
  10. // simple search
  11. var $LiveText = array(
  12. 1 => 'Orange',
  13. 2 => 'Apple',
  14. 3 => 'Pear',
  15. 4 => 'Banana',
  16. 5 => 'Blueberry',
  17. 6 => 'Ananas'
  18. );
  19.  
  20. /**
  21. * Perform a search
  22. *
  23. * @return array
  24. */
  25. function search($input) {
  26. $ret = array();
  27. foreach($this->LiveText as $key => $value) {
  28. if (stristr($value,$input)) {
  29. $ret[$key] = $value;
  30. }
  31. }
  32. return $ret;
  33. }
  34.  
  35. // init method for the LiveText class, includes needed files an registers it for ajax
  36. function initLiveText2() {
  37. $this->registerClass(new LiveText2());
  38. }
  39. }
  40.  
  41. // create an instance of our test server
  42. $server = new LiveText2();
  43. $server->handleRequest();
  44. ?>

Documentation generated on Thu, 12 Apr 2007 08:37:35 +0200 by phpDocumentor 1.3.0RC3