Source for file InvalidCompHandler.inc

Documentation is available at InvalidCompHandler.inc

  1. <?php
  2. /**
  3. * Implements the InvalidComp handler
  4. *
  5. * This file is part of CompInaBox.
  6. * @copyright CompInaBox Copyright 2001-2005. Eric D. Nielsen, All rights reserverd.
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. *
  9. * @author Eric D. Nielsen <nielsene@alum.mit.edu>
  10. * @package InputControllers
  11. * @subpackage Handlers
  12. */
  13. /**
  14. * Implements the InvalidComp handler
  15. *
  16. * @package InputControllers
  17. * @subpackage Handlers
  18. */
  19. class InvalidCompHandler {
  20. var $_status;
  21.  
  22. function InvalidCompHandler($thresh="") {
  23. $this->_status=$thresh;
  24. }
  25.  
  26. function canHandle(&$context, $request) {
  27. $centralDB =& $context->getCentralDB();
  28. $pb =& $context->getCorePhraseBook();
  29. if (""==$this->_status)
  30. $query = $pb->getQuery("Comp Exists?",
  31. array("CompName"=>$request->getCompUnix()));
  32. else
  33. $query = $pb->getQuery("Hosted Comp Exists?",
  34. array("CompName"=>$request->getCompUnix(),
  35. "StatusThreshold"=>$this->_status));
  36.  
  37. $qr =& $centralDB->query($query);
  38. return $qr->numrows()==0;
  39. }
  40.  
  41. function execute(&$context, $request) {
  42. return "InvalidCompName";
  43. }
  44. }
  45. ?>

Documentation generated on Tue, 25 Apr 2006 13:03:50 -0400 by phpDocumentor 1.3.0RC3