groupblockform.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. // @todo FIXME: standard file header missing.
  3. /**
  4. * Form for blocking a user from a group
  5. *
  6. * @category Form
  7. * @package StatusNet
  8. * @author Evan Prodromou <evan@status.net>
  9. * @author Sarven Capadisli <csarven@status.net>
  10. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  11. * @link http://status.net/
  12. *
  13. * @see BlockForm
  14. */
  15. class GroupBlockForm extends Form
  16. {
  17. /**
  18. * Profile of user to block
  19. */
  20. var $profile = null;
  21. /**
  22. * Group to block the user from
  23. */
  24. var $group = null;
  25. /**
  26. * Return-to args
  27. */
  28. var $args = null;
  29. /**
  30. * Constructor
  31. *
  32. * @param HTMLOutputter $out output channel
  33. * @param Profile $profile profile of user to block
  34. * @param User_group $group group to block user from
  35. * @param array $args return-to args
  36. */
  37. function __construct($out=null, $profile=null, $group=null, $args=null)
  38. {
  39. parent::__construct($out);
  40. $this->profile = $profile;
  41. $this->group = $group;
  42. $this->args = $args;
  43. }
  44. /**
  45. * ID of the form
  46. *
  47. * @return int ID of the form
  48. */
  49. function id()
  50. {
  51. // This should be unique for the page.
  52. return 'block-' . $this->profile->id;
  53. }
  54. /**
  55. * class of the form
  56. *
  57. * @return string class of the form
  58. */
  59. function formClass()
  60. {
  61. return 'form_group_block';
  62. }
  63. /**
  64. * Action of the form
  65. *
  66. * @return string URL of the action
  67. */
  68. function action()
  69. {
  70. return common_local_url('groupblock');
  71. }
  72. /**
  73. * Legend of the Form
  74. *
  75. * @return void
  76. */
  77. function formLegend()
  78. {
  79. // TRANS: Form legend for form to block user from a group.
  80. $this->out->element('legend', null, _('Block user from group'));
  81. }
  82. /**
  83. * Data elements of the form
  84. *
  85. * @return void
  86. */
  87. function formData()
  88. {
  89. $this->out->hidden('blockto-' . $this->profile->id,
  90. $this->profile->id,
  91. 'blockto');
  92. $this->out->hidden('blockgroup-' . $this->group->id,
  93. $this->group->id,
  94. 'blockgroup');
  95. if ($this->args) {
  96. foreach ($this->args as $k => $v) {
  97. $this->out->hidden('returnto-' . $k, $v);
  98. }
  99. }
  100. }
  101. /**
  102. * Action elements
  103. *
  104. * @return void
  105. */
  106. function formActions()
  107. {
  108. $this->out->submit(
  109. 'submit',
  110. // TRANS: Button text for the form that will block a user from a group.
  111. _m('BUTTON','Block'),
  112. 'submit',
  113. null,
  114. // TRANS: Submit button title.
  115. _m('TOOLTIP', 'Block this user so that they can no longer post messages to it.'));
  116. }
  117. }