Source for file AuthZPrinter.abstract.php

Documentation is available at AuthZPrinter.abstract.php

  1. <?php
  2. /**
  3. * @since 11/29/06
  4. * @package polyphony.authorization
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: AuthZPrinter.abstract.php,v 1.4 2007/09/19 14:04:40 adamfranco Exp $
  10. */
  11.  
  12. /**
  13. * A static class for printing Authorization information
  14. *
  15. * @since 11/29/06
  16. * @package polyphony.authorization
  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: AuthZPrinter.abstract.php,v 1.4 2007/09/19 14:04:40 adamfranco Exp $
  22. */
  23. class AuthZPrinter {
  24. /**
  25. * Answer the html string for an icon that displays authorization state
  26. *
  27. * @param object Id $qualifierId
  28. * @return string
  29. * @access public
  30. * @since 11/29/06
  31. */
  32. function getAZIcon ($qualifierId) {
  33. ob_start();
  34. $authZ = Services::getService("AuthZ");
  35. $idManager = Services::getService("Id");
  36. if ($authZ->isUserAuthorized(
  37. $idManager->getId("edu.middlebury.authorization.view_authorizations"),
  38. $qualifierId))
  39. {
  40. $onclick = "onclick=\"AuthZViewer.run('".addslashes($qualifierId->getIdString())."', this);\" style='cursor: pointer;' ";
  41. } else {
  42. $onclick = '';
  43. }
  44. if ($authZ->isAuthorized(
  45. $idManager->getId("edu.middlebury.agents.everyone"),
  46. $idManager->getId("edu.middlebury.authorization.view"),
  47. $qualifierId))
  48. {
  49. print "\n<img src='".POLYPHONY_PATH."/icons/view_public.gif' alt='".("Public-Viewable")."' title='".("Public-Viewable")."' ".$onclick."/> ";
  50. } else if ($authZ->isAuthorized(
  51. $idManager->getId("edu.middlebury.agents.users"),
  52. $idManager->getId("edu.middlebury.authorization.view"),
  53. $qualifierId))
  54. {
  55. print "\n<img src='".POLYPHONY_PATH."/icons/view_institute.gif' alt='".("Institution-Viewable")."' title='".("Institution-Viewable")."' ".$onclick."/> ";
  56. } else {
  57. print "\n<img src='".POLYPHONY_PATH."/icons/view_limited.gif' alt='".("Viewable by some people")."' title='".("Viewable by some people")."' ".$onclick."/> ";
  58. }
  59. return ob_get_clean();
  60. }
  61. }
  62.  
  63. ?>

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