当前位置: 首页>>代码示例>>PHP>>正文


PHP BoincUser::enum_fields方法代码示例

本文整理汇总了PHP中BoincUser::enum_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser::enum_fields方法的具体用法?PHP BoincUser::enum_fields怎么用?PHP BoincUser::enum_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoincUser的用法示例。


在下文中一共展示了BoincUser::enum_fields方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export

function export($is_user, $dir)
{
    $n = 0;
    $filename = $is_user ? "{$dir}/user_work" : "{$dir}/team_work";
    $f = fopen($filename, "w");
    if (!$f) {
        die("fopen");
    }
    $is_user ? fprintf($f, "<users>\n") : fprintf($f, "<teams>\n");
    $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        if ($is_user) {
            $items = BoincUser::enum_fields("id", "id>={$n} and id<{$m} and total_credit>0");
        } else {
            $items = BoincTeam::enum_fields("id", "id>={$n} and id<{$m} and total_credit>0");
        }
        foreach ($items as $item) {
            export_item($item, $is_user, $f);
        }
        $n = $m;
    }
    $is_user ? fprintf($f, "</users>\n") : fprintf($f, "</teams>\n");
    fclose($f);
    system("gzip -f {$filename}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:26,代码来源:export_credit_by_app.php

示例2: assign_badges

function assign_badges($is_user, $badge_pctiles, $badge_images)
{
    $kind = $is_user ? "user" : "team";
    $badges = get_pct_badges($kind . "_pct", $badge_pctiles, $badge_images);
    $pctiles = get_percentiles($is_user, $badge_pctiles);
    //echo "thresholds for $kind badges: $pctiles[0] $pctiles[1] $pctiles[2]\n";
    $n = 0;
    $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        if ($is_user) {
            $items = BoincUser::enum_fields("id, expavg_credit", "id>={$n} and id<{$m} and total_credit>0");
        } else {
            $items = BoincTeam::enum_fields("id, expavg_credit", "id>={$n} and id<{$m} and total_credit>0");
        }
        foreach ($items as $item) {
            assign_pct_badge($is_user, $item, $pctiles, $badges);
            // ... assign other types of badges
        }
        $n = $m;
    }
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:22,代码来源:badge_assign.php

示例3: assign_all_badges

function assign_all_badges($is_user, $badge_levels, $badge_level_names, $badge_images, $subprojects_list)
{
    $kind = $is_user ? "user" : "team";
    // get badges for all subprojects including total
    //
    foreach ($subprojects_list as $sp) {
        $badges[$sp["short_name"]] = get_badges($kind, $badge_level_names, $badge_images, $sp);
    }
    $n = 0;
    $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        if ($is_user) {
            $items = BoincUser::enum_fields("id, total_credit", "id>={$n} and id<{$m} and total_credit>0");
        } else {
            $items = BoincTeam::enum_fields("id, total_credit", "id>={$n} and id<{$m} and total_credit>0");
        }
        // for every user/team
        //
        foreach ($items as $item) {
            // for every subproject (incl. total)
            //
            foreach ($subprojects_list as $sp) {
                if ($sp["short_name"] == "total") {
                    assign_tot_badge($is_user, $item, $badge_levels, $badges["total"]);
                } else {
                    // appids come from project/project.inc
                    $where_clause = "appid in (" . implode(',', $sp["appids"]) . ")";
                    assign_sub_badge($is_user, $item, $badge_levels, $badges[$sp["short_name"]], $where_clause);
                }
            }
        }
        $n = $m;
    }
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:35,代码来源:badge_assign_custom.php

示例4: get_int

$teamid = get_int("teamid");
$plain = get_int("plain", true);
$team = BoincTeam::lookup_id($teamid);
if (!$team) {
    error_page(tra("no such team"));
}
require_founder_login($user, $team);
if ($plain) {
    header("Content-type: text/plain");
} else {
    page_head(tra("%1 Email List", $team->name));
    start_table();
    table_header(array(tra("Member list of %1", $team->name), "colspan=\"6\""));
    table_header(tra("Name"), tra("Email address"), tra("Total credit"), tra("Recent average credit"), tra("Country"));
}
$users = BoincUser::enum_fields("id, email_addr, send_email, name, total_credit, expavg_credit, has_profile, donated, country, cross_project_id, create_time, url", "teamid={$team->id}");
foreach ($users as $user) {
    if ($plain) {
        $e = $user->send_email ? "<{$user->email_addr}>" : "";
        echo "{$user->name} {$e}\n";
    } else {
        $e = $user->send_email ? "{$user->email_addr}" : "";
        table_row(user_links($user, BADGE_HEIGHT_MEDIUM), $e, format_credit($user->total_credit), format_credit($user->expavg_credit), $user->country);
    }
}
if (!$plain) {
    end_table();
    echo "<p><a href=\"team_email_list.php?teamid=" . $teamid . "&amp;plain=1\">" . tra("Show as plain text") . "</a></p>";
    page_tail();
}
$cvs_version_tracker[] = "\$Id\$";
开发者ID:brevilo,项目名称:boinc,代码行数:31,代码来源:team_email_list.php

示例5: search_action

function search_action()
{
    $where = "true";
    $search_string = get_str('search_string');
    if (strlen($search_string)) {
        if (strlen($search_string) < 3) {
            error_page(tra("search string must be at least 3 characters"));
        }
        $s = BoincDb::escape_string($search_string);
        $s = escape_pattern($s);
        $where .= " and name like '{$s}%'";
    }
    $country = get_str('country');
    if ($country != 'any') {
        $s = BoincDb::escape_string($country);
        $where .= " and country='{$s}'";
    }
    $t = get_str('team');
    if ($t == 'yes') {
        $where .= " and teamid<>0";
    } else {
        if ($t == 'no') {
            $where .= " and teamid=0";
        }
    }
    $t = get_str('profile');
    if ($t == 'yes') {
        $where .= " and has_profile<>0";
    } else {
        if ($t == 'no') {
            $where .= " and has_profile=0";
        }
    }
    $search_type = get_str('search_type', true);
    $order_clause = "id desc";
    if ($search_type == 'rac') {
        $order_clause = "expavg_credit desc";
    } else {
        if ($search_type == 'total') {
            $order_clause = "total_credit desc";
        }
    }
    $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
    $users = BoincUser::enum_fields($fields, $where, "order by {$order_clause} limit 100");
    page_head(tra("User search results"));
    $n = 0;
    foreach ($users as $user) {
        if ($n == 0) {
            start_table();
            table_header(tra("Name"), tra("Team"), tra("Average credit"), tra("Total credit"), tra("Country"), tra("Joined"));
        }
        show_user($user);
        $n++;
    }
    end_table();
    if (!$n) {
        echo tra("No users match your search criteria.");
    }
    page_tail();
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:60,代码来源:user_search.php

示例6: name_search

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.";
    }
}
开发者ID:Turante,项目名称:boincweb,代码行数:29,代码来源:user_search.php


注:本文中的BoincUser::enum_fields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。