本文整理汇总了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}");
}
示例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;
}
}
示例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;
}
}