Пример #1
0
function print_user_list($users_rs, $keywords)
{
    global $CFG, $SESSION;
    // reset session everytime this function is called
    $SESSION->users_result = array();
    $count = 0;
    foreach ($users_rs as $rs) {
        foreach ($rs as $user) {
            if (!$count) {
                echo '<table border="1" width="100%" id="data-grid"><tr><th>&nbsp;</th><th>' . get_string('user', 'admin') . '</th><th>' . get_string('spamdesc', 'tool_spamcleaner') . '</th><th>' . get_string('spamoperation', 'tool_spamcleaner') . '</th></tr>';
            }
            $count++;
            filter_user($user, $keywords, $count);
        }
    }
    if (!$count) {
        echo get_string('spamcannotfinduser', 'tool_spamcleaner');
    } else {
        echo '</table>';
        echo '<div class="mld-align">
              <button id="removeall_btn">' . get_string('spamdeleteall', 'tool_spamcleaner') . '</button>
              </div>';
    }
}
Пример #2
0
function name_search($filter)
{
    $count = 100;
    $search_string = get_str('search_string');
    if (strlen($search_string) < 3) {
        error_page("search string must be at least 3 characters");
    }
    $s = boinc_real_escape_string($search_string);
    $s = escape_pattern($s);
    $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
    $users = BoincUser::enum_fields($fields, "name like '{$s}%'", "limit {$count}");
    $n = 0;
    foreach ($users as $user) {
        if (!filter_user($user, $filter)) {
            continue;
        }
        if ($n == 0) {
            echo "<h3>User names starting with '" . htmlspecialchars($search_string) . "'</h3>\n";
            start_table();
            table_header("Name", "Team", "Average credit", "Total credit", "Country", "Joined");
        }
        show_user($user);
        $n++;
    }
    end_table();
    if (!$n) {
        echo "No users matching your search criteria.";
    }
}