- if ($column) {
- $ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
- "<tr>
-";
- if( $settable_col !== '' ) {
- $ret .= xml::element( 'th', null, wfMsg( 'userrights-changeable-col' ) );
- }
- if( $unsettable_col !== '' ) {
- $ret .= xml::element( 'th', null, wfMsg( 'userrights-unchangeable-col' ) );
- }
- $ret.= "</tr>
- <tr>
-";
- if( $settable_col !== '' ) {
- $ret .=
-" <td style='vertical-align:top;'>
- $settable_col
- </td>
-";
- }
- if( $unsettable_col !== '' ) {
- $ret .=
-" <td style='vertical-align:top;'>
- $unsettable_col
- </td>
-";
+ # Run a hook to allow extensions to modify the column listing
+ wfRunHooks( 'UserrightsGroupCheckboxes', array( $usergroups, &$columns ) );
+
+ # Build the HTML table
+ $ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
+ "<tr>\n";
+ foreach( $columns as $name => $column ) {
+ if( $column === array() )
+ continue;
+ $ret .= xml::element( 'th', null, wfMsg( 'userrights-' . $name . '-col' ) );
+ }
+ $ret.= "</tr>\n<tr>\n";
+ foreach( $columns as $column ) {
+ if( $column === array() )
+ continue;
+ $ret .= "\t<td style='vertical-align:top;'>\n";
+ foreach( $column as $group => $checkbox ) {
+ $attr = $checkbox['disabled'] ? array( 'disabled' => 'disabled' ) : array();
+ $text = $checkbox['irreversible']
+ ? wfMsgHtml( 'userrights-irreversible-marker', User::getGroupMember( $group ) )
+ : User::getGroupMember( $group );
+ $checkboxHtml = Xml::checkLabel( $text, "wpGroup-" . $group,
+ "wpGroup-" . $group, $checkbox['set'], $attr );
+ $ret .= "\t\t" . ( $checkbox['disabled']
+ ? Xml::tags( 'span', array( 'class' => 'mw-userrights-disabled' ), $checkboxHtml )
+ : $checkboxHtml
+ ) . "<br />\n";