makeadminform.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. // @todo FIXME: add standard file header.
  3. /**
  4. * Form for making a user an admin for 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. class MakeAdminForm extends Form
  14. {
  15. /**
  16. * Profile of user to block
  17. */
  18. var $profile = null;
  19. /**
  20. * Group to block the user from
  21. */
  22. var $group = null;
  23. /**
  24. * Return-to args
  25. */
  26. var $args = null;
  27. /**
  28. * Constructor
  29. *
  30. * @param HTMLOutputter $out output channel
  31. * @param Profile $profile profile of user to block
  32. * @param User_group $group group to block user from
  33. * @param array $args return-to args
  34. */
  35. function __construct($out=null, $profile=null, $group=null, $args=null)
  36. {
  37. parent::__construct($out);
  38. $this->profile = $profile;
  39. $this->group = $group;
  40. $this->args = $args;
  41. }
  42. /**
  43. * ID of the form
  44. *
  45. * @return int ID of the form
  46. */
  47. function id()
  48. {
  49. // This should be unique for the page.
  50. return 'makeadmin-' . $this->profile->id;
  51. }
  52. /**
  53. * class of the form
  54. *
  55. * @return string class of the form
  56. */
  57. function formClass()
  58. {
  59. return 'form_make_admin';
  60. }
  61. /**
  62. * Action of the form
  63. *
  64. * @return string URL of the action
  65. */
  66. function action()
  67. {
  68. return common_local_url('makeadmin', array('nickname' => $this->group->nickname));
  69. }
  70. /**
  71. * Legend of the Form
  72. *
  73. * @return void
  74. */
  75. function formLegend()
  76. {
  77. // TRANS: Form legend for form to make a user a group admin.
  78. $this->out->element('legend', null, _('Make user an admin of the group'));
  79. }
  80. /**
  81. * Data elements of the form
  82. *
  83. * @return void
  84. */
  85. function formData()
  86. {
  87. $this->out->hidden('profileid-' . $this->profile->id,
  88. $this->profile->id,
  89. 'profileid');
  90. $this->out->hidden('groupid-' . $this->group->id,
  91. $this->group->id,
  92. 'groupid');
  93. if ($this->args) {
  94. foreach ($this->args as $k => $v) {
  95. $this->out->hidden('returnto-' . $k, $v);
  96. }
  97. }
  98. }
  99. /**
  100. * Action elements
  101. *
  102. * @return void
  103. */
  104. function formActions()
  105. {
  106. $this->out->submit(
  107. 'submit',
  108. // TRANS: Button text for the form that will make a user administrator.
  109. _m('BUTTON','Make Admin'),
  110. 'submit',
  111. null,
  112. // TRANS: Submit button title.
  113. _m('TOOLTIP','Make this user an admin.'));
  114. }
  115. }