Skip to content

Commit

Permalink
Tracking: Duplicated users report: Add context about active column - …
Browse files Browse the repository at this point in the history
…refs BT#20575
  • Loading branch information
AngelFQC committed Mar 8, 2023
1 parent ee1425d commit a935bbd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
20 changes: 18 additions & 2 deletions main/inc/lib/statistics.lib.php
Expand Up @@ -1836,7 +1836,22 @@ function ($value) {
$table->set_header($column++, $fieldInfo['display_text']);
}

$table->set_header($column, get_lang('Active'));
$table->set_header($column++, get_lang('Active'));
$table->set_column_filter(
$column - 1,
function ($value) {
if ('1' == $value) {
return get_lang('Active');
}

if ('0' == $value) {
return get_lang('Inactive');
}

return get_lang('ActionNotAllowed');
}
);
$table->set_header($column, get_lang('Actions'));
$table->set_column_filter(
$column,
[UserManager::class, 'getActiveFilterForTable']
Expand Down Expand Up @@ -1939,7 +1954,8 @@ private static function getDuplicatedUsers(array $additionalExtraFieldsInfo): ar
$studentInfo[] = $extraValue['value'] ?? null;
}

$studentInfo[] = $rowUser['active'];
$studentInfo[] = $rowUser['active']; // once to show status
$studentInfo[] = $rowUser['active']; // twice to show actions

$usersInfo[] = $studentInfo;
}
Expand Down
11 changes: 7 additions & 4 deletions main/inc/lib/usermanager.lib.php
Expand Up @@ -7847,24 +7847,27 @@ public static function getActiveFilterForTable(string $active, string $params, a
}

if ('edit' === $action) {
$langAccountExpired = get_lang('AccountExpired');

return Display::return_icon(
$image.'.png',
get_lang('AccountExpired'),
$langAccountExpired,
[],
ICON_SIZE_TINY
);
).'<span class="sr-only" aria-hidden="true">'.$langAccountExpired.'</span>';
}

if ($row['0'] != api_get_user_id()) {
$langAction = get_lang(ucfirst($action));
// you cannot lock yourself out otherwise you could disable all the
// accounts including your own => everybody is locked out and nobody
// can change it anymore.
return Display::return_icon(
$image.'.png',
get_lang(ucfirst($action)),
$langAction,
['onclick' => 'active_user(this);', 'id' => 'img_'.$row['0'], 'style' => 'cursor: pointer;'],
ICON_SIZE_TINY
);
).'<span class="sr-only" aria-hidden="true">'.$langAction.'</span>';
}

return '';
Expand Down

0 comments on commit a935bbd

Please sign in to comment.