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"));
30
32
$results_per_page = 20;
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;
44
$s = $state_name[$state];
38
46
$host = BoincHost::lookup_id($hostid);
47
if (!$host) error_page(tra("No computer with ID %1 found", $hostid));
40
48
$clause = "hostid=$hostid";
49
page_head(tra("$s tasks for computer %1", $host->id));
50
$show_host_link = false;
42
52
$user = get_logged_in_user();
43
53
if ($userid != $user->id) {
44
error_page("No access");
54
error_page(tra("No access"));
47
56
$clause = "userid=$userid";
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;
60
error_page(tra("Missing user ID or host ID"));
63
$clause2 = $clause. $state_clause[$state];
65
$clause2 .= ' AND appid='.$appid;
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
58
foreach ($results as $result) {
59
if ($i >= $results_per_page) break;
60
show_result_row($result, true, false, true, $i);
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;
80
if (count($results)) {
81
echo show_result_navigation($info);
82
result_table_start(true, $show_host_link, $info);
84
foreach ($results as $result) {
85
if ($i >= $results_per_page) break;
86
show_result_row($result, true, $show_host_link, $show_names, $i);
92
row1(tra("No tasks to display"));
65
echo show_result_navigation(
66
$clause, $number_of_results, $offset, $results_per_page
96
echo show_result_navigation($info);