-
Notifications
You must be signed in to change notification settings - Fork 7
/
su_show_project.php
84 lines (77 loc) · 2.99 KB
/
su_show_project.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 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/>.
// show detail page for a project
require_once("../inc/util.inc");
require_once("../inc/su_db.inc");
require_once("../inc/su.inc");
require_once("../inc/su_project_infos.inc");
require_once("../inc/keywords.inc");
function su_show_project($project, $user) {
global $job_keywords;
global $project_infos;
page_head($project->name);
start_table("table-striped");
row2("Name", $project->name);
row2("URL", "<a href=$project->url>$project->url</a>");
if ($project->url != $project->web_url) {
row2("Web URL", $project->web_url);
}
if (is_admin($user)) {
row2("Created", date_str($project->create_time));
row2("Status", project_status_string($project->status));
row2("Allocation share", $project->share);
row2("", '<a class="btn btn-success" href="su_projects_edit.php?action=edit_project_form&id='.$project->id.'">Edit status and share</a>');
row2("Average TFLOPS", number_format(ec_to_tflops($project->avg_ec), 3));
row2("Average TFLOPS, adjusted", number_format(ec_to_tflops($project->avg_ec_adjusted), 3));
}
$pks = $project_infos[$project->id]->kws;
$sci = array();
$loc = array();
if ($pks) {
foreach ($pks as $pk) {
$kwd = $job_keywords[$pk->keyword_id];
$x = array($pk, $kwd->name);
if ($kwd->category == KW_CATEGORY_SCIENCE) {
$sci[] = $x;
}
if ($kwd->category == KW_CATEGORY_LOC) {
$loc[] = $x;
}
}
}
row2("Science keywords", project_keyword_array_to_string($sci));
row2("Location keywords", project_keyword_array_to_string($loc));
row2("Platforms", get_platforms_string($project->id));
row2("Accounting",
sprintf(
'Last 30 days:<br><img src="su_graph.php?type=project&id=%d&what=ec&ndays=%d&xsize=%d&ysize=%d"><br><a href=su_projects_acct.php?project_id=%d class="btn btn-success">History</a>',
$project->id, 30, 500, 300, $project->id
)
);
end_table();
page_tail();
}
$id = get_int('id');
$project = SUProject::lookup_id($id);
if (!$project) {
error_page("no such project");
}
$user = get_logged_in_user(false);
BoincForumPrefs::lookup($user);
su_show_project($project, $user);
?>