Skip to content

Commit

Permalink
Reporting : Add filter by active users in course reporting - BT#19731
Browse files Browse the repository at this point in the history
  • Loading branch information
cfasanando committed Feb 23, 2022
1 parent 9128008 commit c74621a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main/inc/lib/display.lib.php
Expand Up @@ -2091,7 +2091,7 @@ public static function tip($text, $tip, string $tag = 'span')
if (empty($tip)) {
return $text;
}

return self::tag(
$tag,
$text,
Expand Down
7 changes: 7 additions & 0 deletions main/inc/lib/tracking.lib.php
Expand Up @@ -8902,6 +8902,13 @@ public static function get_user_data(
) ";
}

if (isset($_GET['user_active'])) {
$active = (int) $_GET['user_active'];
$condition_user .= " AND (
user.active = $active
) ";
}

$url_table = '';
$url_condition = '';
if (api_is_multiple_url_enabled()) {
Expand Down
12 changes: 11 additions & 1 deletion main/tracking/courseLog.php
Expand Up @@ -275,10 +275,20 @@ function(index) {
$form_search->addHidden('id_session', $sessionId);
$form_search->addHidden('cidReq', $courseCode);
$form_search->addElement('text', 'user_keyword');

// Filter by active users
$activeChecked = isset($_GET['user_active']) ? (int) $_GET['user_active'] : '';
$form_search->addElement('html', '<div class="form-group" style="margin: 0px 10px;">');
$form_search->addElement('html', '<span>'.get_lang('ActiveAccount').'</span>: <span>
<input type="radio" name="user_active" value="1" '.(1 === $activeChecked ? 'checked' : '').' /> '.get_lang('Yes').'&nbsp;
<input type="radio" name="user_active" value="0" '.(0 === $activeChecked ? 'checked' : '').' /> '.get_lang('No').'</span>');
$form_search->addElement('html', '</div>');

$form_search->addButtonSearch(get_lang('SearchUsers'));
echo Display::toolbarAction(
'toolbar-courselog',
[$actionsLeft, $form_search->returnForm(), $actionsRight]
[$actionsLeft, $form_search->returnForm(), $actionsRight],
[4, 6, 2]
);

$course_name = get_lang('Course').' '.$courseInfo['name'];
Expand Down

0 comments on commit c74621a

Please sign in to comment.