~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to html/user/results.php

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
$config = get_config();
26
26
if (!parse_bool($config, "show_results")) {
27
 
    error_page("This feature is turned off temporarily");
 
27
    error_page(tra("This feature is turned off temporarily"));
28
28
}
29
29
 
 
30
BoincDb::get(true);
 
31
 
30
32
$results_per_page = 20;
31
33
 
32
34
$hostid = get_int("hostid", true);
33
35
$userid = get_int("userid", true);
34
36
$offset = get_int("offset", true);
 
37
$appid = get_int("appid", true);
35
38
if (!$offset) $offset=0;
 
39
$state = get_int("state", true);
 
40
if (!$state) $state=0;
 
41
$show_names = get_int("show_names", true);
 
42
if (!$show_names) $show_names=0;
36
43
 
 
44
$s = $state_name[$state];
37
45
if ($hostid) {
38
46
    $host = BoincHost::lookup_id($hostid);
39
 
    $type = "computer";
 
47
    if (!$host) error_page(tra("No computer with ID %1 found", $hostid));
40
48
    $clause = "hostid=$hostid";
41
 
} else {
 
49
    page_head(tra("$s tasks for computer %1", $host->id));
 
50
    $show_host_link = false;
 
51
} else if ($userid){
42
52
    $user = get_logged_in_user();
43
53
    if ($userid != $user->id) {
44
 
        error_page("No access");
 
54
        error_page(tra("No access"));
45
55
    }
46
 
    $type = "user";
47
56
    $clause = "userid=$userid";
48
 
}
49
 
page_head("Tasks for $type");
50
 
result_table_start(true, false, true);
51
 
$query = "$clause order by id desc limit $offset,".($results_per_page+1);
 
57
    page_head(tra("$s tasks for $user->name"));
 
58
    $show_host_link = true;
 
59
} else {
 
60
    error_page(tra("Missing user ID or host ID"));
 
61
}
 
62
 
 
63
$clause2 = $clause. $state_clause[$state];
 
64
if ($appid) {
 
65
    $clause2 .= ' AND appid='.$appid;
 
66
}
 
67
 
 
68
$query = "$clause2 order by id desc limit $offset,".($results_per_page+1);
52
69
$results = BoincResult::enum($query);
53
 
$number_of_results = count($results);
54
 
echo show_result_navigation(
55
 
    $clause, $number_of_results, $offset, $results_per_page
56
 
);
57
 
$i = 0;
58
 
foreach ($results as $result) {
59
 
    if ($i >= $results_per_page) break;
60
 
    show_result_row($result, true, false, true, $i);
61
 
    $i++;
 
70
 
 
71
$info = null;
 
72
$info->number_of_results = count($results);
 
73
$info->clause = $clause;
 
74
$info->results_per_page = $results_per_page;
 
75
$info->offset = $offset;
 
76
$info->show_names = $show_names;
 
77
$info->state = $state;
 
78
$info->appid = $appid;
 
79
 
 
80
if (count($results)) {
 
81
    echo show_result_navigation($info);
 
82
    result_table_start(true, $show_host_link, $info);
 
83
    $i = 0;
 
84
    foreach ($results as $result) {
 
85
        if ($i >= $results_per_page) break;
 
86
        show_result_row($result, true, $show_host_link, $show_names, $i);
 
87
        $i++;
 
88
    }
 
89
    echo "</table>\n";
 
90
} else {
 
91
    start_table();
 
92
    row1(tra("No tasks to display"));
 
93
    end_table();
62
94
}
63
 
echo "</table>\n";
64
95
 
65
 
echo show_result_navigation(
66
 
    $clause, $number_of_results, $offset, $results_per_page
67
 
);
 
96
echo show_result_navigation($info);
68
97
 
69
98
page_tail();
70
99
?>