2003-10-27 17:49:05 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 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/>.
|
2007-11-12 22:28:17 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
// show recent results for a host or user
|
2003-10-27 17:49:05 +00:00
|
|
|
|
2007-11-12 22:28:17 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2005-02-19 08:06:53 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/result.inc");
|
2003-10-27 17:49:05 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
$config = get_config();
|
|
|
|
if (!parse_bool($config, "show_results")) {
|
2007-02-18 18:03:28 +00:00
|
|
|
error_page("This feature is turned off temporarily");
|
2005-02-19 08:06:53 +00:00
|
|
|
}
|
2004-07-02 19:17:53 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
$results_per_page = 20;
|
2003-10-27 17:49:05 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
$hostid = get_int("hostid", true);
|
|
|
|
$userid = get_int("userid", true);
|
|
|
|
$offset = get_int("offset", true);
|
|
|
|
if (!$offset) $offset=0;
|
2004-01-06 22:09:19 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
if ($hostid) {
|
2007-11-12 22:28:17 +00:00
|
|
|
$host = BoincHost::lookup_id($hostid);
|
2005-02-19 08:06:53 +00:00
|
|
|
$type = "computer";
|
|
|
|
$clause = "hostid=$hostid";
|
|
|
|
} else {
|
|
|
|
$user = get_logged_in_user();
|
|
|
|
if ($userid != $user->id) {
|
|
|
|
error_page("No access");
|
2003-10-27 17:49:05 +00:00
|
|
|
}
|
2005-02-19 08:06:53 +00:00
|
|
|
$type = "user";
|
|
|
|
$clause = "userid=$userid";
|
|
|
|
}
|
2007-10-04 17:30:28 +00:00
|
|
|
page_head("Tasks for $type");
|
2005-02-19 08:06:53 +00:00
|
|
|
result_table_start(true, false, true);
|
2007-11-12 22:28:17 +00:00
|
|
|
$query = "$clause order by id desc limit $offset,".($results_per_page+1);
|
|
|
|
$results = BoincResult::enum($query);
|
|
|
|
$number_of_results = count($results);
|
2006-05-04 04:29:28 +00:00
|
|
|
echo show_result_navigation(
|
|
|
|
$clause, $number_of_results, $offset, $results_per_page
|
|
|
|
);
|
2008-08-07 20:43:52 +00:00
|
|
|
$i = 0;
|
2007-11-12 22:28:17 +00:00
|
|
|
foreach ($results as $result) {
|
|
|
|
if ($i >= $results_per_page) break;
|
2008-08-07 20:43:52 +00:00
|
|
|
show_result_row($result, true, false, true, $i);
|
2005-02-19 08:06:53 +00:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2004-03-24 01:41:49 +00:00
|
|
|
|
2006-05-04 04:29:28 +00:00
|
|
|
echo show_result_navigation(
|
|
|
|
$clause, $number_of_results, $offset, $results_per_page
|
|
|
|
);
|
2003-10-27 17:49:05 +00:00
|
|
|
|
2005-02-19 08:06:53 +00:00
|
|
|
page_tail();
|
2003-10-27 17:49:05 +00:00
|
|
|
?>
|