groupblockform.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. public $widgetOpts;
  18. public $scoped;
  19. /**
  20. * Profile of user to block
  21. */
  22. var $profile = null;
  23. /**
  24. * Group to block the user from
  25. */
  26. var $group = null;
  27. /**
  28. * Return-to args
  29. */
  30. var $args = null;
  31. /**
  32. * Constructor
  33. *
  34. * @param HTMLOutputter $out output channel
  35. * @param Profile $profile profile of user to block
  36. * @param User_group $group group to block user from
  37. * @param array $args return-to args
  38. */
  39. function __construct($out=null, $profile=null, $group=null, $args=null)
  40. {
  41. parent::__construct($out);
  42. $this->profile = $profile;
  43. $this->group = $group;
  44. $this->args = $args;
  45. }
  46. /**
  47. * ID of the form
  48. *
  49. * @return int ID of the form
  50. */
  51. function id()
  52. {
  53. // This should be unique for the page.
  54. return 'block-' . $this->profile->id;
  55. }
  56. /**
  57. * class of the form
  58. *
  59. * @return string class of the form
  60. */
  61. function formClass()
  62. {
  63. return 'form_group_block';
  64. }
  65. /**
  66. * Action of the form
  67. *
  68. * @return string URL of the action
  69. */
  70. function action()
  71. {
  72. return common_local_url('groupblock');
  73. }
  74. /**
  75. * Legend of the Form
  76. *
  77. * @return void
  78. */
  79. function formLegend()
  80. {
  81. // TRANS: Form legend for form to block user from a group.
  82. $this->out->element('legend', null, _('Block user from group'));
  83. }
  84. /**
  85. * Data elements of the form
  86. *
  87. * @return void
  88. */
  89. function formData()
  90. {
  91. $this->out->hidden('blockto-' . $this->profile->id,
  92. $this->profile->id,
  93. 'blockto');
  94. $this->out->hidden('blockgroup-' . $this->group->id,
  95. $this->group->id,
  96. 'blockgroup');
  97. if ($this->args) {
  98. foreach ($this->args as $k => $v) {
  99. $this->out->hidden('returnto-' . $k, $v);
  100. }
  101. }
  102. }
  103. /**
  104. * Action elements
  105. *
  106. * @return void
  107. */
  108. function formActions()
  109. {
  110. $this->out->submit(
  111. 'submit',
  112. // TRANS: Button text for the form that will block a user from a group.
  113. _m('BUTTON','Block'),
  114. 'submit',
  115. null,
  116. // TRANS: Submit button title.
  117. _m('TOOLTIP', 'Block this user so that they can no longer post messages to it.'));
  118. }
  119. }