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")) {
|
2008-12-13 21:27:37 +00:00
|
|
|
error_page(tra("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;
|
2009-03-18 22:53:55 +00:00
|
|
|
$state = get_int("state", true);
|
|
|
|
if (!$state) $state=0;
|
2009-02-19 18:39:03 +00:00
|
|
|
$show_names = get_int("show_names", true);
|
|
|
|
if (!$show_names) $show_names=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);
|
2009-02-19 18:39:03 +00:00
|
|
|
if (!$host) error_page(tra("No computer with ID %1 found", $hostid));
|
2005-02-19 08:06:53 +00:00
|
|
|
$clause = "hostid=$hostid";
|
2009-02-19 18:39:03 +00:00
|
|
|
page_head(tra("Tasks for computer %1", $host->id));
|
2008-12-13 21:27:37 +00:00
|
|
|
} else if ($userid){
|
2005-02-19 08:06:53 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
if ($userid != $user->id) {
|
2008-12-13 21:27:37 +00:00
|
|
|
error_page(tra("No access"));
|
2003-10-27 17:49:05 +00:00
|
|
|
}
|
2005-02-19 08:06:53 +00:00
|
|
|
$clause = "userid=$userid";
|
2009-02-19 18:39:03 +00:00
|
|
|
page_head(tra("Tasks for $user->name"));
|
2008-12-13 21:27:37 +00:00
|
|
|
} else {
|
2009-03-16 19:39:16 +00:00
|
|
|
error_page(tra("Missing user ID or host ID"));
|
2005-02-19 08:06:53 +00:00
|
|
|
}
|
2009-03-16 19:39:16 +00:00
|
|
|
|
2009-03-18 22:53:55 +00:00
|
|
|
$clause2 = $clause. $state_clause[$state];
|
2009-03-16 19:39:16 +00:00
|
|
|
|
2009-03-18 22:53:55 +00:00
|
|
|
$query = "$clause2 order by id desc limit $offset,".($results_per_page+1);
|
2007-11-12 22:28:17 +00:00
|
|
|
$results = BoincResult::enum($query);
|
2009-02-19 18:39:03 +00:00
|
|
|
|
|
|
|
$info = null;
|
|
|
|
$info->number_of_results = count($results);
|
|
|
|
$info->clause = $clause;
|
|
|
|
$info->results_per_page = $results_per_page;
|
|
|
|
$info->offset = $offset;
|
|
|
|
$info->show_names = $show_names;
|
2009-03-18 22:53:55 +00:00
|
|
|
$info->state = $state;
|
2009-02-19 18:39:03 +00:00
|
|
|
|
|
|
|
echo show_result_navigation($info);
|
|
|
|
result_table_start(true, false, $info);
|
|
|
|
|
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;
|
2009-02-19 18:39:03 +00:00
|
|
|
show_result_row($result, true, false, $show_names, $i);
|
2005-02-19 08:06:53 +00:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2004-03-24 01:41:49 +00:00
|
|
|
|
2009-02-19 18:39:03 +00:00
|
|
|
echo show_result_navigation($info);
|
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
|
|
|
?>
|