Source for file GroupsOnlyFromTraversalIterator.class.php

Documentation is available at GroupsOnlyFromTraversalIterator.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."oki2/agent/AgentFilteringFromTraversalIterator.class.php");
  4.  
  5. /**
  6. * AgentIterator provides access to these objects sequentially, one at a time.
  7. * The purpose of all Iterators is to to offer a way for OSID methods to
  8. * return multiple values of a common type and not use an array. Returning an
  9. * array may not be appropriate if the number of values returned is large or
  10. * is fetched remotely. Iterators do not allow access to values by index,
  11. * rather you must access values in sequence. Similarly, there is no way to go
  12. * backwards through the sequence unless you place the values in a data
  13. * structure, such as an array, that allows for access by index.
  14. *
  15. * <p>
  16. * OSID Version: 2.0
  17. * </p>
  18. *
  19. * @package harmoni.osid_v2.agent
  20. *
  21. * @copyright Copyright &copy; 2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  23. *
  24. * @version $Id: GroupsOnlyFromTraversalIterator.class.php,v 1.3 2007/09/04 20:25:36 adamfranco Exp $
  25. */
  26. class GroupsOnlyFromTraversalIterator
  27. extends AgentFilteringFromTraversalIterator
  28. // implements AgentIterator
  29.  
  30. {
  31. /**
  32. * Return True if we should select the Agent with the given id, FALSE if
  33. * we are filtering it.
  34. *
  35. * @param object Id $id
  36. * @return boolean
  37. * @access private
  38. * @since 8/31/05
  39. */
  40. function _shouldSelect ( $id ) {
  41. $agentManager = Services::getService("Agent");
  42. if ($agentManager->isGroup($id))
  43. return TRUE;
  44. else
  45. return FALSE;
  46. }
  47. /**
  48. * create a new Agent of the appropriate class and return it.
  49. *
  50. * @param object Id $id
  51. * @return object Agent
  52. * @access private
  53. * @since 8/31/05
  54. */
  55. function _getAgent ( $id ) {
  56. $agentManager = Services::getService("Agent");
  57. return $agentManager->getGroup($id);
  58. }
  59.  
  60. }
  61.  
  62. ?>

Documentation generated on Wed, 19 Sep 2007 10:23:26 -0400 by phpDocumentor 1.3.0RC3