本文整理汇总了PHP中BoincTeam类的典型用法代码示例。如果您正苦于以下问题:PHP BoincTeam类的具体用法?PHP BoincTeam怎么用?PHP BoincTeam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BoincTeam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_user_wap
function show_user_wap($user)
{
wap_begin();
if (!$user) {
echo "<br/>User not found!<br/>";
wap_end();
return;
}
// keep a 'running tab' in wapstr in case exceeds 1K WAP limit
$wapstr = PROJECT . "<br/>Account Data<br/>for {$user->name}<br/>Time: " . wap_timestamp();
$wapstr .= show_credit_wap($user);
if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid);
$wapstr .= "<br/>Team: {$team->name}<br/>";
$wapstr .= "Team TotCred: " . format_credit($team->total_credit) . "<br/>";
$wapstr .= "Team AvgCred: " . format_credit($team->expavg_credit) . "<br/>";
} else {
$wapstr .= "<br/>Team: None<br/>";
}
// don't want to send more than 1KB probably?
if (strlen($wapstr) > 1024) {
echo substr($wapstr, 0, 1024);
} else {
echo $wapstr;
}
wap_end();
}
示例2: 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}");
}
示例3: show_user_wap
function show_user_wap($userid)
{
wap_begin();
$user = BoincUser::lookup_id($userid);
if (!$user) {
echo "<br/>" . tra("User not found!") . "<br/>";
wap_end();
return;
}
if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid);
}
$wapstr = PROJECT . "<br/>" . tra("Account Data<br/>for %1<br/>Time:", $user->name) . " " . wap_timestamp();
$wapstr .= show_credit_wap($user);
if ($user->teamid && $team) {
$wapstr .= "<br/>" . tra("Team:") . " " . $team->name . "<br/>";
$wapstr .= tra("Team TotCred:") . " " . format_credit($team->total_credit) . "<br/>";
$wapstr .= tra("Team AvgCred:") . " " . format_credit($team->expavg_credit) . "<br/>";
} else {
$wapstr .= "<br/>" . tra("Team: None") . "<br/>";
}
// don't want to send more than 1KB (WAP limit)
//
if (strlen($wapstr) > 1024) {
$wapstr = substr($wapstr, 0, 1024);
}
echo $wapstr;
wap_end();
}
示例4: show_row
function show_row($x, $y, $mode, $i)
{
$class = $i % 2 ? "row0" : "row1";
echo "<tr class={$class}><td>";
switch ($mode) {
case 'host':
echo "<a href=show_host_detail.php?hostid={$x}>{$x}</a>";
break;
case 'user':
$user = BoincUser::lookup_id($x);
echo "<a href=show_user.php?userid={$x}>{$user->name}</a>";
break;
case 'team':
$team = BoincTeam::lookup_id($x);
if ($team) {
echo "<a href=team_display.php?teamid={$x}>{$team->name}</a>";
} else {
echo "(no team)";
}
break;
case 'model':
echo $x;
break;
case 'day':
echo $x;
break;
}
echo "</td><td align=right>" . format_credit_large($y->credit), "</td><td align=right>{$y->nresults}</td></tr>\n";
}
示例5: get_teams
function get_teams($clause, $active)
{
$c2 = '';
if ($active) {
$c2 = "and expavg_credit>0.1";
}
return BoincTeam::enum("{$clause} {$c2} order by expavg_credit desc limit 20");
}
示例6: show_user
function show_user($user)
{
echo "\n <tr class=row1>\n <td>", user_links($user), " (ID {$user->id})</td>\n ";
if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid);
echo "\n <td> <a href=team_display.php?teamid={$team->id}>{$team->name}</a> </td>\n ";
} else {
echo "<td><br></td>";
}
echo "\n <td align=right>", format_credit($user->expavg_credit), "</td>\n <td align=right>", format_credit_large($user->total_credit), "</td>\n <td>", $user->country, "</td>\n <td>", time_str($user->create_time), "</td>\n </tr>\n ";
}
示例7: main
function main()
{
$f = fopen("temp.xml", "w");
$teams = BoincTeam::enum();
fwrite($f, "<teams>\n");
foreach ($teams as $team) {
handle_team($team, $f);
}
fwrite($f, "</teams>\n");
fclose($f);
rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml");
}
示例8: get_teams
function get_teams($clause, $active)
{
$c2 = '';
if ($active) {
$c2 = "and expavg_credit>0.1";
}
$x = BoincTeam::enum("{$clause} {$c2} order by expavg_credit desc limit 20");
foreach ($x as $t) {
$t->refcnt = 0;
}
return $x;
}
示例9: main
function main()
{
echo "------------ Starting at " . time_str(time()) . "-------\n";
$f = fopen("temp.xml", "w");
$teams = BoincTeam::enum(null);
fwrite($f, "<teams>\n");
foreach ($teams as $team) {
handle_team($team, $f);
}
fwrite($f, "</teams>\n");
fclose($f);
if (!rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml")) {
echo "Rename failed\n";
}
}
示例10: get_top_teams
function get_top_teams($offset, $sort_by, $type)
{
global $teams_per_page;
$db = BoincDb::get(true);
$type_clause = null;
if ($type) {
$type_clause = "type={$type}";
}
if ($sort_by == "total_credit") {
$sort_order = "total_credit desc";
} else {
$sort_order = "expavg_credit desc";
}
return BoincTeam::enum($type_clause, "order by {$sort_order} limit {$offset}, {$teams_per_page}");
}
示例11: 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;
}
}
示例12: show_forum_summary
function show_forum_summary($forum, $i)
{
switch ($forum->parent_type) {
case 0:
$t = $forum->title;
$d = $forum->description;
break;
case 1:
$team = BoincTeam::lookup_id($forum->category);
$t = $forum->title;
if (!strlen($t)) {
$t = $team->name;
}
$d = $forum->description;
if (!strlen($d)) {
$d = tra("Discussion among members of %1", $team->name);
}
break;
}
$j = $i % 2;
echo "\n <tr class=\"row{$j}\">\n <td>\n <a href=\"forum_forum.php?id={$forum->id}\">{$t}</a>\n <br><span class=\"smalltext\">{$d}</span>\n </td>\n <td class=\"numbers\">{$forum->threads}</td>\n <td class=\"numbers\">{$forum->posts}</td>\n <td class=\"lastpost\">" . time_diff_str($forum->timestamp, time()) . "</td>\n </tr>";
}
示例13: show_row
function show_row($item, $apps, $is_team, $i)
{
$j = $i % 2;
if ($is_team) {
$team = BoincTeam::lookup_id($item->teamid);
if (!$team) {
return;
}
$x = "<td>" . team_links($team) . "</td>\n";
} else {
$user = BoincUser::lookup_id($item->userid);
if (!$user) {
return;
}
$x = "<td>" . user_links($user, BADGE_HEIGHT_MEDIUM) . "</td>\n";
}
echo "<tr class=row{$j}>";
echo "<td>{$i}</td>\n";
echo $x;
foreach ($apps as $app) {
if ($app->id == $item->appid) {
$c = $item;
} else {
if ($is_team) {
$c = BoincCreditTeam::lookup("teamid={$item->teamid} and appid={$app->id}");
} else {
$c = BoincCreditUser::lookup("userid={$item->userid} and appid={$app->id}");
}
if (!$c) {
$c = new StdClass();
$c->expavg = 0;
$c->total = 0;
}
}
echo "<td align=right>" . format_credit($c->expavg) . "</td><td align=right>" . format_credit_large($c->total) . "</td>\n";
}
echo "</tr>\n";
}
示例14: page_head
case 0:
$category = BoincCategory::lookup_id($forum->category);
if ($category->is_helpdesk) {
page_head(tra("Questions and Answers") . ' : ' . $forum->title);
?>
<link href="forum_help_desk.php" rel="up" title="Forum Index"><?php
} else {
page_head(tra("Message boards") . ' : ' . $forum->title);
?>
<link href="forum_index.php" rel="up" title="Forum Index"><?php
}
show_forum_header($user);
show_forum_title($category, $forum, NULL);
break;
case 1:
$team = BoincTeam::lookup_id($forum->category);
page_head('Team message board for <a href="team_display.php?teamid=$team->id">$team->name</a>');
show_forum_header($user);
show_team_forum_title($forum);
break;
}
?>
<form action="forum_forum.php" method="get">
<?php
echo start_table("noborder");
?>
<table width="100%">
<tr valign="top">
<td colspan="2">
<?php
show_button("forum_post.php?id={$id}", "New thread", "Add a new thread to this forum");
示例15: admin_page_tail
if (_mysql_num_rows($result) < 1) {
echo "There are no new users.";
admin_page_tail();
}
start_table();
table_header("ID", "Name", "Email", "Team", "Country", "Joined");
while ($row = _mysql_fetch_object($result)) {
$id = $row->id;
$name = $row->name;
$email = $row->email_addr;
$country = $row->country;
$joined = time_str($row->create_time);
$email_validated = $row->email_validated;
$team_name = "";
if ($row->teamid > 0) {
$team = BoincTeam::lookup_id($row->teamid);
$team_name = $team->name;
}
// Special Users:
$roles = "";
$user = $row;
BoincForumPrefs::lookup($user);
$special_bits = $user->prefs->special_user;
if ($special_bits != "0") {
for ($i = 0; $i < 7; $i++) {
$bit = substr($special_bits, $i, 1);
if ($bit == '1') {
if (!empty($roles)) {
$roles .= ", ";
}
$roles .= $special_user_bitfield[$i];