Example #1
0
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();
}
Example #2
0
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();
}