本文整理汇总了PHP中BoincTeam类的典型用法代码示例。如果您正苦于以下问题:PHP BoincTeam类的具体用法?PHP BoincTeam怎么用?PHP BoincTeam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BoincTeam类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:Turante,项目名称:boincweb,代码行数:27,代码来源:userw.php
示例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}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:26,代码来源:export_credit_by_app.php
示例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();
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:29,代码来源:userw.php
示例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";
}
开发者ID:Turante,项目名称:boincweb,代码行数:29,代码来源:show_coproc.php
示例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");
}
开发者ID:Turante,项目名称:boincweb,代码行数:8,代码来源:team_search.php
示例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 ";
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:11,代码来源:user_search.php
示例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");
}
开发者ID:Turante,项目名称:boincweb,代码行数:12,代码来源:team_export.php
示例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;
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:12,代码来源:team_search.php
示例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";
}
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:15,代码来源:team_export.php
示例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}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:15,代码来源:top_teams.php
示例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;
}
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:22,代码来源:badge_assign.php
示例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>";
}
开发者ID:happyj,项目名称:qcn,代码行数:22,代码来源:forum_index.php
示例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";
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:38,代码来源:per_app_list.php
示例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");
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:forum_forum.php
示例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];
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:list_new_users.php
示例16: 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
示例17: xml_header
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
xml_header();
$retval = db_init_xml();
if ($retval) {
xml_error($retval);
}
check_get_args(array("account_key"));
$auth = get_str("account_key");
$user = BoincUser::lookup_auth($auth);
if (!$user) {
xml_error(ERR_DB_NOT_FOUND);
}
$name = urlencode($user->name);
$country = urlencode($user->country);
$postal_code = urlencode($user->postal_code);
$url = urlencode($user->url);
$weak_auth = weak_auth($user);
$cpid = md5($user->cross_project_id . $user->email_addr);
$ret = "<id>{$user->id}</id>\n<name>{$name}</name>\n<country>{$country}</country>\n<weak_auth>{$weak_auth}</weak_auth>\n<postal_code>{$postal_code}</postal_code>\n<cpid>{$cpid}</cpid>\n<has_profile>{$user->has_profile}</has_profile>\n<create_time>{$user->create_time}</create_time>\n<global_prefs>\n{$user->global_prefs}\n</global_prefs>\n<project_prefs>\n{$user->project_prefs}\n</project_prefs>\n<url>{$url}</url>\n<send_email>{$user->send_email}</send_email>\n<show_hosts>{$user->show_hosts}</show_hosts>\n<teamid>{$user->teamid}</teamid>\n<venue>{$user->venue}</venue>";
if ($user->teamid) {
$team = BoincTeam::lookup_id_nocache($user->teamid);
if ($team->userid == $user->id) {
$ret = $ret . "<teamfounder/>\n";
}
}
echo "<am_get_info_reply>\n <success/>\n {$ret}\n</am_get_info_reply>\n";
开发者ID:ChristianBeer,项目名称:boinc,代码行数:31,代码来源:am_get_info.php
示例18: error_page
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2014 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
if (DISABLE_TEAMS) {
error_page("Teams are disabled");
}
check_get_args(array());
$user = get_logged_in_user();
page_head(tra("Create a team"));
if ($user->teamid && ($team = BoincTeam::lookup_id($user->teamid))) {
echo tra("You belong to %1. You must %2quit this team%3 before creating a new one.", "<a href=\"team_display.php?teamid=" . $team->id . "\">" . $team->name . "</a>", "<a href=\"team_quit_form.php\">", "</a>");
} else {
team_edit_form(null, tra("Create a team"), "team_create_action.php");
}
page_tail();
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:team_create_form.php
示例19: do_send_team
function do_send_team($logged_in_user)
{
check_tokens($logged_in_user->authenticator);
$subject = post_str("subject", true);
$content = post_str("content", true);
$teamid = post_int("teamid");
if (post_str("preview", true) == tra("Preview")) {
pm_team_form($logged_in_user, $teamid);
return;
}
// make sure user is authorized, i.e. is a team admin
//
$team = BoincTeam::lookup_id($teamid);
if (!$team) {
error_page("no such team");
}
if (!is_team_admin($logged_in_user, $team)) {
error_page("no team admin");
}
if ($subject == null || $content == null) {
pm_team_form($logged_in_user, $teamid, tra("You need to fill all fields to send a private message"));
return;
}
$subject = "Message from team " . $team->name . ": " . $subject;
// don't use tra() here because we don't know language of recipient
// Also, we use it in pm_count() to exclude team messages from limit check
$users = BoincUser::enum("teamid={$teamid}");
foreach ($users as $user) {
pm_send_msg($logged_in_user, $user, $subject, $content, true);
}
page_head(tra("Message sent"));
echo tra("Your message was sent to %1 team members.", count($users));
page_tail();
}
开发者ID:gchilders,项目名称:boinc,代码行数:34,代码来源:pm.php
示例20: handle_team
function handle_team($f)
{
$t = parse_team($f);
if (!$t) {
echo "Failed to parse team\n";
return;
}
//print_r($t);
//return;
if (!valid_team($t)) {
echo "Invalid team\n";
return;
}
echo "Processing {$t->name} {$t->user_email}\n";
$user = BoincUser::lookup_email_addr($t->user_email);
$team = BoincTeam::lookup_name($t->name);
if ($team) {
if (!$user) {
echo " team exists but user {$t->user_email} doesn't\n";
return;
}
if ($user->id != $team->userid) {
echo " team exists but is owned by a different user\n";
return;
}
if ($team->seti_id) {
if ($team->seti_id == $t->id) {
echo " case 1\n";
update_team($t, $team, $user);
// update1 case
} else {
echo " team exists but has wrong seti_id\n";
}
} else {
$team2 = lookup_team_seti_id($t->id);
if ($team2) {
// update1 case
echo " case 2\n";
update_team($t, $team2, $user);
} else {
// update2 case
echo " case 3\n";
update_team($t, $team, $user);
}
}
} else {
$team = lookup_team_seti_id($t->id);
if ($team) {
echo " A team with same ID but different name exists;\n";
echo " Please report this to {$t->user_email};\n";
} else {
echo " Adding team\n";
insert_case($t, $user);
}
}
}
开发者ID:ChristianBeer,项目名称:boinc,代码行数:56,代码来源:team_import.php
注:本文中的BoincTeam类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论