-
Notifications
You must be signed in to change notification settings - Fork 4
/
im_peditor.php
executable file
·103 lines (89 loc) · 2.95 KB
/
im_peditor.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
<?php
header('Content-Type: text/html; charset=utf-8');
include ("include.php");
include ("chn_scraper.php");
$team_sel = $_GET["team_sel"];
if($team_sel)
{
?>
<!--<form action="im_peditor.php" style="display:inline-block" ><input type="submit" name="stats" value="Update All Stats"/><input type="hidden" name="team_sel" value="<?= $team_sel ?>"/></form>-->
<?
if($_GET['stats']) {
$team = fetchTeam($team_sel);
$chn = fopen("http://www.collegehockeynews.com/stats/team-overall.php?td=" . $team['chn_id'],"r");
$contents = stream_get_contents($chn);
$contents = mb_convert_encoding($contents, 'UTF-8', 'ASCII');
$contents = str_replace("\xc2\x9a", "\xc5\xa1" , $contents); // replace incorrect "Single Character Introducer" with "Small Latin S with Caron"
$data = parser($contents);
$output = '<table id="details">';
foreach($data as $players) {
$output .= update($players);
}
$output .= "</table>";
echo ' - Updated, details <a href="#details">below the table</a>.<div class="playerTable"></div>' . $output;
} else {
echo '<div class="playerTable"></div>';
}
?>
<script src="js/lib/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="js/lib/jquery-ui-1.8.12.custom.min.js" type="text/javascript"></script>
<script src="im.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var eventsTable = new EditableTable({
dbTable: 'players',
columnHeaders: ['ID','Num','First','Last','Pos','Height','Weight','Year','Hometown','SType','S1','S2','S3','S4','S5','S6','S7','S8','Team'],
uneditableColumns: ['id'],
element: $('.playerTable'),
displayFunction: {
id: function(id) {
return $('<a href="im_render_title.php?player='+id+'">'+id+'</a>');
}
}
});
eventsTable.loadTable(0,100,'team = "<?= $team_sel ?>"','NUM ASC');
$('#all').click(function(){
$('.erow').trigger('click');
});
});
</script>
<style type="text/css">
tr {
height:30px;
}
tr.erow td, tr.nrow td {
width:100px;
max-width:150px;
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
}
td.editing input {
width: inherit;
}
td.action, th.action {
width:120px;
}
th {
text-align: left;
}
.s1, .s2, .s3, .s4, .s5, .s6, .s7, .num, .id, .pos, .height, .weight, .year, .stype {
width:40px !important;
}
.hometown, .s8 {
width:150px !important;
}
</style>
<!--<button id="all">Edit All</button> If Matt asks for this, I'll add it, otherwise I don't like it -->
<? } else { ?>
<h2>Select a team</h2>
<form action="im_peditor.php" method="get">
<?
$query = "SELECT * FROM teams";
$result = dbquery($query);
while($row = mysql_fetch_array($result)) {
$team = fetchTeam($row['player_abbrev']);
echo("<div style=\"float:left;width:100px\"><img width=\"30\" src=\"" . $team["logo"] . "\"><br><input type=\"submit\" name=\"team_sel\" value=\"" . $team["player_abbrev"] . "\"></div>");
} ?>
</form>
<? } ?>