Ticket #8785: compatibility.2.php

File compatibility.2.php, 5.3 KB (added by jvprat, 16 years ago)

Updated compatibility page v2

Line 
1<?
2
3/*
4 * ScummVM Compatibility Page
5 *
6 */
7
8// set this for position of this file relative
9$file_root = ".";
10
11// load libraries
12require($file_root."/include/"."incl.php");
13
14// Load the compatibility information for the requested version
15if (isset($_GET['version'])) {
16 // Filter very long versions and strange characters
17 $version = substr($_GET['version'], 0, 10);
18 $version = preg_replace('/[^a-z0-9\.]/i', "", $version);
19
20 // Test whether the file exists
21 if (!file_exists($file_root."/compat-".$version.".inc"))
22 $version = "SVN";
23} else {
24 $version = "SVN";
25}
26include($file_root."/compat-".$version.".inc");
27
28// start of html
29html_page_header('ScummVM :: Compatibility - '.$version);
30
31html_content_begin($version.' Compatibility');
32
33if (isset($_GET['details'])) {
34 $details = $_GET['details'];
35}
36
37?>
38 <div class="par-item">
39
40<?php
41
42if ($details) {
43
44 echo '<div class="par-content">';
45
46}
47else {
48?>
49 <div class="par-intro">
50<br>
51 This page lists the progress of ScummVM as it relates to individual game compatibility.
52 Please note this list applies to the English versions of games. We attempt to test many versions of games, however there are occasionally problems with other languages.<br><br>
53 Click on the game name to view the complete notes of a game.<br><br>
54<?
55
56// Get the available versions of compatibility information
57$versions = array();
58if ($dir = opendir($file_root)) {
59 while (($compatfile = readdir($dir)) !== false) {
60 if (substr($compatfile, 0, 7) == "compat-" && substr($compatfile, -4) == ".inc") {
61 $ver = substr($compatfile, 7, strlen($compatfile) - 11);
62 if ($ver != "SVN")
63 $versions[] = $ver;
64 }
65 }
66 closedir($dir);
67}
68
69// Sort by version number
70natsort($versions);
71
72// Latest version first
73$versions = array_reverse($versions);
74
75if ($version == "SVN") {
76?>
77 This is the compatibility of the current WIP SVN version, <B>not of a stable release</B>
78 (Please see one of the following for the Compatibility charts of the stable releases:
79<?
80
81foreach ($versions as $ver)
82 echo " <a href=\"compatibility.php?version=".$ver."\">".$ver."</a>";
83
84?>).<br><br>
85 As this is the status of the Work In Progress version, occasional temporary bugs
86 may be introduced with new changes, thus this list refects the 'best case' scenario.
87 It is highly recommended to use the latest stable release, where possible.
88<?
89} else {
90?>
91 Also, this is the compatibility of the <? echo $version; ?> stable release, <B>not
92 of SVN snapshots/daily builds</B>. The status of these can be found on the <a href="compatibility.php">SVN Compatibility</A> chart.<br>
93 You can also see the Compatibility chart for these releases:
94<?
95
96foreach ($versions as $ver)
97 if ($ver != $version)
98 echo " <a href=\"compatibility.php?version=".$ver."\">".$ver."</a>";
99
100}
101?>
102 <br><br>
103 <small>Last Updated: <? echo date("F d, Y",filemtime($file_root."/compat-".$version.".inc")); ?></small>
104<br>
105<br>
106 </div>
107<br>
108 <div class="par-content">
109
110<?
111 // Display the Color Key Table
112 echo html_frame_start("Color Key","85%",1,1,"color4");
113 $pcts = array(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100);
114 while (list($key,$num) = each($pcts))
115 {
116 $keyTD .= html_frame_td($num,'align=center class="pct'.$num.'"');
117 }
118 echo html_frame_tr($keyTD);
119 echo html_frame_end(),html_br();
120}
121
122// render the compatibility chart
123
124if ($details) {
125 // 'Details' mode -- information about a specific game
126 echo html_frame_start("Game Compatibility Chart","90%",2,1,"color4");
127 echo html_frame_tr(
128 html_frame_td("Game Full Name").
129 html_frame_td("Game Short Name").
130 html_frame_td("% Completed"),
131 "color4"
132
133 );
134
135 $arrayt = array();
136 foreach($gamesCompanies as $ar) {
137 $arrayt = array_merge($arrayt, $ar);
138 }
139 while (list($name,$array) = each($arrayt))
140 {
141
142 if ($array[0] == $details) {
143 $color = "color0";
144 echo html_frame_tr(
145 html_frame_td($name).
146 html_frame_td($array[0]).
147 html_frame_td($array[1]."%", 'align="center" class="pct'.($array[1] - ($array[1]%5)).'"'),
148 $color
149 );
150 echo html_frame_tr(html_frame_td(
151 html_br().
152 html_blockquote($notes{$details}).
153 html_br(),
154 "colspan=4")
155 );
156 }
157 }
158} else {
159 // List mode -- show all games
160 function displayGameList($title, $games) {
161 global $version;
162
163 echo html_frame_start("$title Game Compatibility Chart","95%",2,1,"color4");
164 echo html_frame_tr(
165 html_frame_td("Game Full Name").
166 html_frame_td("Game Short Name").
167 html_frame_td("% Completed"),
168 "color4"
169 );
170 $c = 0;
171 while (list($name,$array) = each($games))
172 {
173 if ($c % 2 == 0) { $color = "color2"; } else { $color = "color0"; }
174 echo html_frame_tr(
175 html_frame_td(html_ahref($name, $PHP_SELF."?version=".$version."&amp;details=".$array[0])).
176 html_frame_td($array[0]).
177 html_frame_td($array[1]."%", 'align="center" class="pct'.($array[1] - ($array[1]%5)).'"'),
178 $color
179 );
180 $c++;
181 }
182 }
183
184 $i = 0;
185 while (list($name,$games) = each($gamesCompanies))
186 {
187 if ($i != 0) {
188 echo html_frame_end("&nbsp;");
189 echo html_p();
190 }
191
192 displayGameList($name, $games);
193
194 $i++;
195 }
196
197}
198
199echo html_frame_end("&nbsp;");
200
201if ($details)
202 echo '<p class="bottom-link"><a href="javascript:history.back(1)">&lt;&lt;Back</a></p>'."\n";
203
204echo " <br>";
205echo " </div>\n";
206echo "</div>\n";
207
208html_content_end();
209html_page_footer();
210
211?>