1 | <?php |
||
2 | // This file is part of BOINC. |
||
3 | // http://boinc.berkeley.edu |
||
4 | // Copyright (C) 2023 University of California |
||
5 | // |
||
6 | // BOINC is free software; you can redistribute it and/or modify it |
||
7 | // under the terms of the GNU Lesser General Public License |
||
8 | // as published by the Free Software Foundation, |
||
9 | // either version 3 of the License, or (at your option) any later version. |
||
10 | // |
||
11 | // BOINC is distributed in the hope that it will be useful, |
||
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
14 | // See the GNU Lesser General Public License for more details. |
||
15 | // |
||
16 | // You should have received a copy of the GNU Lesser General Public License |
||
17 | // along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
||
18 | |||
19 | // show certificate listing join time and credit across all projects |
||
20 | // Projects can customize this: |
||
21 | // https://github.com/BOINC/boinc/wiki/WebConfig#certificate-related-constants |
||
22 | |||
23 | require_once("../inc/util.inc"); |
||
24 | require_once("../inc/cert.inc"); |
||
25 | require_once("../inc/user.inc"); |
||
26 | |||
27 | $border = get_str("border", true); |
||
28 | if ($border=="no") { |
||
29 | $border=0; |
||
30 | } else { |
||
31 | $border=8; |
||
32 | } |
||
33 | |||
34 | // Make sure user_id is in the URL so that share functions work |
||
35 | // |
||
36 | $user_id = get_int('user_id', true); |
||
37 | if (!$user_id) { |
||
38 | $user = get_logged_in_user(); |
||
39 | Header(sprintf('Location: %s/cert_all.php?user_id=%d%s', |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
40 | url_base(), $user->id, $border==0?'&border=no':'' |
||
41 | )); |
||
42 | exit; |
||
43 | } |
||
44 | $user = BoincUser::lookup_id($user_id); |
||
45 | |||
46 | $join = gmdate('j F Y', $user->create_time); |
||
47 | $today = gmdate('j F Y', time()); |
||
48 | |||
49 | $font = "\"Optima,Lucida Bright,Times New Roman\""; |
||
50 | |||
51 | $user = get_other_projects($user); |
||
52 | |||
53 | if (!$user->projects) { |
||
54 | error_page("No accounts found"); |
||
55 | } |
||
56 | |||
57 | $total_credit = 0; |
||
58 | foreach ($user->projects as $p) { |
||
59 | $total_credit += $p->total_credit; |
||
60 | } |
||
61 | |||
62 | $credit = credit_string($total_credit, false); |
||
63 | |||
64 | function show_proj($p) { |
||
65 | $join = date('j F Y', $p->create_time); |
||
66 | echo "<tr> <td>$p->name</td><td> $p->total_credit</td><td>$join</td></tr> |
||
67 | "; |
||
68 | } |
||
69 | |||
70 | echo " |
||
71 | <table id=\"certificate\" width=900 height=650 border=$border cellpadding=20><tr><td> |
||
72 | <center> |
||
73 | <table width=700 border=0><tr><td style=\"background-position:center; background-repeat:no-repeat\" background=https://boinc.berkeley.edu/logo/boinc_fade_600.png> |
||
74 | <center> |
||
75 | <font style=\"font-size: 52\" face=$font>Certificate of Computation |
||
76 | |||
77 | <font face=$font style=\"font-size:28\"> |
||
78 | <br><br> |
||
79 | This certifies that |
||
80 | <p> |
||
81 | <font face=$font style=\"font-size:32\"> |
||
82 | $user->name |
||
83 | |||
84 | <font face=$font style=\"font-size:18\"> |
||
85 | <p> |
||
86 | has contributed $credit |
||
87 | to the following scientific research projects: |
||
88 | |||
89 | <center> |
||
90 | <table width=80%> |
||
91 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
||
92 | "; |
||
93 | foreach ($user->projects as $p) { |
||
94 | if ($p->total_credit<100) continue; |
||
95 | show_proj($p); |
||
96 | } |
||
97 | echo " |
||
98 | </table> |
||
99 | </center> |
||
100 | "; |
||
101 | |||
102 | echo " |
||
103 | </td> |
||
104 | "; |
||
105 | echo " |
||
106 | </td><tr></table></table> |
||
107 | "; |
||
108 | show_download_button(); |
||
109 | show_share_buttons(); |
||
110 | ?> |
||
111 |