Source for file remove_from_group.act.php

Documentation is available at remove_from_group.act.php

  1. <?php
  2. /**
  3. * @package polyphony.agents
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: remove_from_group.act.php,v 1.11 2007/09/19 14:04:52 adamfranco Exp $
  9. */
  10.  
  11. /**
  12. * add_to_group.act.php
  13. * This action will add the agent and group ids passed to it to the specified group.
  14. * 11/10/04 Adam Franco
  15. *
  16. * @package polyphony.agents
  17. *
  18. * @copyright Copyright &copy; 2005, Middlebury College
  19. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  20. *
  21. * @version $Id: remove_from_group.act.php,v 1.11 2007/09/19 14:04:52 adamfranco Exp $
  22. */
  23. require_once(POLYPHONY."/main/library/AbstractActions/MainWindowAction.class.php");
  24.  
  25. /**
  26. * This action will allow for the modification of group Membership.
  27. *
  28. * @since 11/10/04
  29. *
  30. * @package polyphony.agents
  31. *
  32. * @copyright Copyright &copy; 2005, Middlebury College
  33. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  34. *
  35. * @version $Id: remove_from_group.act.php,v 1.11 2007/09/19 14:04:52 adamfranco Exp $
  36. */
  37. class remove_from_groupAction
  38. extends MainWindowAction
  39. {
  40. /**
  41. * Check Authorizations
  42. *
  43. * @return boolean
  44. * @access public
  45. * @since 4/26/05
  46. */
  47. function isAuthorizedToExecute () {
  48. $idManager = Services::getService("Id");
  49. $agentManager = Services::getService("Agent");
  50. $harmoni = Harmoni::instance();
  51. $harmoni->request->startNamespace("polyphony-agents");
  52. $destinationId =$idManager->getId(RequestContext::value('destinationgroup'));
  53. $harmoni->request->endNamespace();
  54.  
  55. // Check for authorization
  56. $authZManager = Services::getService("AuthZ");
  57. $idManager = Services::getService("IdManager");
  58. if ($authZManager->isUserAuthorized(
  59. $idManager->getId("edu.middlebury.authorization.remove_children"),
  60. $destinationId))
  61. {
  62. return TRUE;
  63. } else
  64. return FALSE;
  65. }
  66. /**
  67. * Build the content for this action
  68. *
  69. * @return void
  70. * @access public
  71. * @since 4/26/05
  72. */
  73. function buildContent () {
  74.  
  75. $idManager = Services::getService("Id");
  76. $agentManager = Services::getService("Agent");
  77. $harmoni = Harmoni::instance();
  78. $harmoni->request->startNamespace("polyphony-agents");
  79. $id =$idManager->getId(RequestContext::value('destinationgroup'));
  80. $destGroup =$agentManager->getGroup($id);
  81. foreach ($harmoni->request->getKeys() as $idString) {
  82. $type = RequestContext::value($idString);
  83. if ($type == "group" || $type == "agent") {
  84. $id =$idManager->getId(strval($idString));
  85. if ($type == "group") {
  86. $member =$agentManager->getGroup($id);
  87. } else {
  88. $member =$agentManager->getAgent($id);
  89. }
  90. $destGroup->remove($member);
  91. }
  92. }
  93. $harmoni->request->endNamespace();
  94. // Send us back to where we were
  95. $harmoni->history->goBack("polyphony/agents/add_to_group");
  96. }
  97. }

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