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


PHP BoincTeam::enum_fields方法代码示例

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


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


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