-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.php
132 lines (93 loc) · 3.39 KB
/
player.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
// Pagina di statistiche di un giocatore
include_once "inclusions.php";
$player = NULL;
$match_id = NULL; // Partita da visualizzare per prima
if ( array_key_exists("id", $_GET) ) {
$player_id = $_GET["id"];
if ( is_numeric($player_id) ) {
$player_id = (int)$player_id;
$player = new Player($player_id);
if ( ! ($player->load()) ) {
$player = NULL;
}
else {
// Carico anche il resto
$player->load_participations();
if ( array_key_exists("match_id", $_GET) ) {
$mid = $_GET["match_id"];
if ( is_numeric($mid) ) $match_id = (int)$mid;
}
if ( !array_key_exists( $match_id, $player->participations ) ) $match_id = NULL;
}
}
}
$name = "";
if ( ! is_null($player) ) $name = $player->fname." ".$player->lname;
start_html("Statistiche - ".$name);
make_header(true, "history");
if ( is_null($player) ) {
echo "<h3>Giocatore inesistente.</h3>";
}
else {
start_box($name);
echo '<table id="tabella_top"><tr><td>';
// Menu con le scelte
//make_title("Partecipazioni", 3);
echo '<p><table id="tabella_scelte"><col width="100" />';
echo '<tr><th id="spart0" class="selected_choice"><a href=\'javascript:change_choice("0")\'>Globale</a></th>';
//echo '<td id="spart0.1" class="highlighted">'.format_time($player->seconds).'</td><td id="spart0.2" class="highlighted">'.$player->pos_goals.' gol</td>';
echo '</tr>';
foreach ( $player->participations as $part ) {
$id = $part[0]->id;
echo '<tr><th id="spart'.$id.'" class="choice" ><a href=\'javascript:change_choice("'.$id.'")\'>'.$part[0]->year.'</a></th>';
//echo '<td id="spart'.$id.'.1">'.format_time($part[2]->seconds).'</td><td id="spart'.$id.'.2">'.$part[2]->pos_goals.' gol</td>';
echo '</tr>';
}
echo '</table></p>';
echo '</td><td class="side_padding">';
// Cose a sinistra
echo '<div id="part0"></div>';
foreach ( $player->participations as $part ) {
echo '<div id="part'.$part[0]->id.'"></div>';
}
echo '</td></tr></table>';
// Codice javascript
echo '<script type="text/javascript">';
foreach ( $player->participations as $part ) {
echo 'hide("part'.$part[0]->id.'");';
}
echo 'var pid = "'.$player->id.'";';
if ( !is_null($match_id) ) echo 'var mid = "'.$match_id.'";';
else echo 'var mid = "0";';
?>
var current_displayed = "0";
var loaded = {};
function change_choice(x) {
if ( !(x in loaded) ) {
load( "part".concat( x ), "player_details.php?id=".concat( pid ).concat( "&match_id=" ).concat( x ) );
/*load( "graph_time".concat( x ), "graph_time.php?player_id=".concat( pid ).concat( "&match_id=" ).concat( x ) );*/
}
var s = "spart";
document.getElementById( s.concat( current_displayed ) ).setAttribute("class", "choice");
/*
document.getElementById( s.concat( current_displayed ).concat( ".1" ) ).setAttribute("class", "");
document.getElementById( s.concat( current_displayed ).concat( ".2" ) ).setAttribute("class", "");
*/
document.getElementById( s.concat( x ) ).setAttribute("class", "selected_choice");
/*
document.getElementById( s.concat( x ).concat( ".1" ) ).setAttribute("class", "highlighted");
document.getElementById( s.concat( x ).concat( ".2" ) ).setAttribute("class", "highlighted");
*/
var p = "part";
hide( p.concat( current_displayed ) );
show( p.concat( x ) );
current_displayed = x;
}
change_choice( mid );
<?php
echo '</script>';
}
end_box();
end_html();
?>