mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-06-20 05:45:49 +00:00
This removes the old (and confusing) percent values and replaces them with a simple scheme of: unsupported, playable and completable. A initial adaption of the compatibility page of the development version has been done. This might need some reclassification! All the old compatibility pages keep their percent values.
102 lines
3.0 KiB
PHP
102 lines
3.0 KiB
PHP
<?php
|
|
require_once('Controller.php');
|
|
require_once('Models/CompatibilityModel.php');
|
|
/**
|
|
* The Compatibility page gets all the data from the CompatibilityModel and
|
|
* either displays the full list of games, or specific details about one
|
|
* game. It defaults to showing the compatibility list of the DEV-version.
|
|
*/
|
|
class CompatibilityPage extends Controller {
|
|
private $_template;
|
|
private $_template_details;
|
|
private $_supportLevelDesc;
|
|
private $_supportLevelClass;
|
|
|
|
/* Constructor. */
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->_template = 'compatibility.tpl';
|
|
$this->_template_details = 'compatibility_details.tpl';
|
|
$this->_supportLevelDesc = array(
|
|
'unsupported' => 'Unsupported',
|
|
'playable' => 'Playable',
|
|
'completable' => 'Completable'
|
|
);
|
|
$this->_supportLevelClass = array(
|
|
'unsupported' => 'pct0',
|
|
'playable' => 'pct50',
|
|
'completable' => 'pct100'
|
|
);
|
|
}
|
|
|
|
/* Display the index page. */
|
|
public function index() {
|
|
$version = (!empty($_GET['v']) ? $_GET['v'] : 'DEV');
|
|
$target = $_GET['t'];
|
|
if ($version === 'DEV' || (CompatibilityModel::compareVersions($version, $COMPAT_LAYOUT_CHANGE) < 0)) {
|
|
$oldLayout = 'no';
|
|
} else {
|
|
$oldLayout = 'yes';
|
|
}
|
|
|
|
if (!empty($target)) {
|
|
return $this->getGame($target, $version, $oldLayout);
|
|
} else {
|
|
return $this->getAll($version, $oldLayout);
|
|
}
|
|
}
|
|
|
|
/* We should show detailed information for a specific target. */
|
|
public function getGame($target, $version, $oldLayout) {
|
|
$game = CompatibilityModel::getGameData($version, $target);
|
|
|
|
$this->addCSSFiles(array('chart.css', 'compatibility.css'));
|
|
return $this->renderPage(
|
|
array(
|
|
'title' => "Compatibility - {$version}",
|
|
'content_title' => "{$version} Compatibility",
|
|
'version' => $version,
|
|
'game' => $game,
|
|
'old_layout' => $oldLayout,
|
|
'support_level_desc' => $this->_supportLevelDesc,
|
|
'support_level_class' => $this->_supportLevelClass
|
|
),
|
|
$this->_template_details
|
|
);
|
|
}
|
|
|
|
/* We should show all the compatibility stats for a specific version. */
|
|
public function getAll($version, $oldLayout) {
|
|
/* Default to DEV */
|
|
$versions = CompatibilityModel::getAllVersions();
|
|
if (!in_array($version, $versions)) {
|
|
$version = 'DEV';
|
|
}
|
|
/* Remove the current version from the versions array. */
|
|
if ($version != 'DEV') {
|
|
$key = array_search($version, $versions);
|
|
unset($versions[$key]);
|
|
}
|
|
$filename = DIR_COMPAT . "/compat-{$version}.xml";
|
|
$last_updated = date("F d, Y", @filemtime($filename));
|
|
$compat_data = CompatibilityModel::getAllData($version);
|
|
|
|
$this->addCSSFiles(array('chart.css', 'compatibility.css'));
|
|
return $this->renderPage(
|
|
array(
|
|
'title' => "Compatibility - {$version}",
|
|
'content_title' => "{$version} Compatibility",
|
|
'version' => $version,
|
|
'compat_data' => $compat_data,
|
|
'last_updated' => $last_updated,
|
|
'versions' => $versions,
|
|
'old_layout' => $oldLayout,
|
|
'support_level_desc' => $this->_supportLevelDesc,
|
|
'support_level_class' => $this->_supportLevelClass
|
|
),
|
|
$this->_template
|
|
);
|
|
}
|
|
}
|
|
?>
|