Permalink
Browse files

New other results page which contains gaming, television and ereaders

  • Loading branch information...
1 parent 6cc3962 commit e11c04fa7f511033296b828b12c36e13124860e9 @NielsLeenheer NielsLeenheer committed Nov 21, 2013
Showing with 589 additions and 181 deletions.
  1. +1 −0 .htaccess
  2. +226 −103 backend/controllers/results.php
  3. +278 −0 backend/templates/results-other.html
  4. +82 −77 backend/templates/results.html
  5. +1 −1 css/main.css
  6. +1 −0 css/reporting.css
View
@@ -27,6 +27,7 @@ RewriteRule ^results/mobile.html$ /backend/controllers/results.php?type=mobile
RewriteRule ^results/tablet.html$ /backend/controllers/results.php?type=tablet
RewriteRule ^results/gaming.html$ /backend/controllers/results.php?type=gaming
RewriteRule ^results/television.html$ /backend/controllers/results.php?type=television
+RewriteRule ^results/other.html$ /backend/controllers/results.php?type=other
RewriteRule ^results/latest.html$ /backend/controllers/latest.php
RewriteRule ^results/search.html$ /backend/controllers/search.php
RewriteRule ^devicelab/?$ /backend/controllers/lab.php
@@ -7,122 +7,245 @@
$type = $_REQUEST['type'];
- if (!in_array($type, array('desktop', 'mobile', 'tablet', 'gaming', 'television'))) $type = 'desktop';
-
+ if (!in_array($type, array('desktop', 'mobile', 'tablet', 'gaming', 'television', 'other'))) $type = 'desktop';
+
+ if (in_array($type, array('gaming', 'television'))) {
+ header('Location: /results/other.html#' . $type);
+ exit;
+ }
- $tpl = new Template('../templates/results.html');
- $tpl->set('type', $type);
-
-
-
- $main = array();
- $names = array();
-
- $res = mysql_query("
- SELECT
- b.status, IFNULL(v.nickname,v.name) AS name, b.variant, IFNULL(b.version,'') AS version, f.score
- FROM
- browserVersions AS b
- LEFT JOIN browserVariants AS v ON (b.variant = v.id)
- LEFT JOIN scores AS s ON (b.variant = s.variant AND b.version = s.version)
- LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
- WHERE
- v.importance > 0 AND
- b.listed = 1 AND
- s.release = '" . $version . "' AND
- FIND_IN_SET('" . $type . "',b.type)
- ORDER BY
- IFNULL(v.nickname,v.name), !ISNULL(b.release), b.release DESC
- ");
-
- $count = 0;
-
- while ($row = mysql_fetch_object($res)) {
- $names[$row->name] = $row->name;
-
- if (!isset($main[$row->name])) {
- $main[$row->name] = array(null, null);
+ if ($type == 'other') {
+ $tpl = new Template('../templates/results-other.html');
+ $tpl->set('type', $type);
+
+
+ $consoles = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('gaming-console',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $consoles[] = $row;
}
- if ($row->status == 'development') {
- $main[$row->name][0] = $row;
+ $tpl->set('consoles', $consoles);
+
+ $portables = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('gaming-portable',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $portables[] = $row;
}
-
- if ($row->status == 'current') {
- $main[$row->name][1] = $row;
+
+ $tpl->set('portables', $portables);
+
+ $smarttvs = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('television-smart',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $smarttvs[$row->status][] = $row;
}
- if ($row->status == 'legacy' && count($main[$row->name]) < 8) {
- $main[$row->name][] = $row;
+ $tpl->set('smarttvs', $smarttvs);
+
+ $settopboxes = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('television-box',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $settopboxes[] = $row;
}
- $count = max($count, count($main[$row->name]));
- }
-
- $tpl->set('main', $main);
- $tpl->set('mainRows', $count);
- $tpl->set('mainColumns', $names);
+ $tpl->set('settopboxes', $settopboxes);
+ $ereaders = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('ereader',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $ereaders[] = $row;
+ }
+
+ $tpl->set('ereaders', $ereaders);
-
- $results = array();
-
- $res = mysql_query("
- SELECT
- b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
- FROM
- browserVersions AS b
- LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
- LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
- WHERE
- s.release = '" . $version . "' AND
- FIND_IN_SET('" . $type . "',type)
- ORDER BY
- score DESC
- ");
-
- while ($row = mysql_fetch_object($res)) {
- $results[$row->status][] = $row;
+
+ echo $tpl->fetch();
}
-
-
- $tpl->set('results', $results);
- if (isset($results['current']) && count($results['current']) > 0) $tpl->set('first', $results['current'][0]);
- if (isset($results['current']) && count($results['current']) > 1) $tpl->set('runnerup', $results['current'][1]);
- if (isset($results['development']) && count($results['development']) > 0) $tpl->set('upcoming', $results['development'][0]);
-
-
+ else {
+ $tpl = new Template('../templates/results.html');
+ $tpl->set('type', $type);
+
- $sets = array();
-
- $res = mysql_query("
- SELECT
- v.importance, IFNULL(v.nickname,v.name) AS name, b.grouped, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, IF(ISNULL(b.release),DATE(NOW()),b.release) AS `release`, b.status, f.score
- FROM
- browserVersions AS b
- LEFT JOIN browserVariants AS v ON (b.variant = v.id)
- LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
- LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
- WHERE
- (!ISNULL(b.release) OR b.status = 'development') AND
- s.release = '" . $version . "' AND
- FIND_IN_SET('" . $type . "',v.type) AND
- !ISNULL(f.score)
- ORDER BY
- b.grouped, `release`
- ");
-
- echo mysql_error();
-
- while ($row = mysql_fetch_object($res)) {
- $sets[$row->grouped]['name'] = $row->grouped;
- $sets[$row->grouped]['data'][] = $row;
- }
-
- $tpl->set('sets', $sets);
-
+ $main = array();
+ $names = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, IFNULL(v.nickname,v.name) AS name, b.variant, IFNULL(b.version,'') AS version, f.score
+ FROM
+ browserVersions AS b
+ LEFT JOIN browserVariants AS v ON (b.variant = v.id)
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND b.version = s.version)
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ v.importance > 0 AND
+ b.listed = 1 AND
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('" . $type . "',b.type)
+ ORDER BY
+ IFNULL(v.nickname,v.name), !ISNULL(b.release), b.release DESC
+ ");
+
+ $count = 0;
+
+ while ($row = mysql_fetch_object($res)) {
+ $names[$row->name] = $row->name;
+
+ if (!isset($main[$row->name])) {
+ $main[$row->name] = array(null, null);
+ }
+
+ if ($row->status == 'development') {
+ $main[$row->name][0] = $row;
+ }
+
+ if ($row->status == 'current') {
+ $main[$row->name][1] = $row;
+ }
+
+ if ($row->status == 'legacy' && count($main[$row->name]) < 8) {
+ $main[$row->name][] = $row;
+ }
+
+ $count = max($count, count($main[$row->name]));
+ }
+
+ $tpl->set('main', $main);
+ $tpl->set('mainRows', $count);
+ $tpl->set('mainColumns', $names);
+
+
+
+ $results = array();
+
+ $res = mysql_query("
+ SELECT
+ b.status, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, b.description, b.listed, f.score, f.points, f.results
+ FROM
+ browserVersions AS b
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('" . $type . "',type)
+ ORDER BY
+ score DESC
+ ");
+
+ while ($row = mysql_fetch_object($res)) {
+ $results[$row->status][] = $row;
+ }
- echo $tpl->fetch();
+
+ $tpl->set('results', $results);
+ if (isset($results['current']) && count($results['current']) > 0) $tpl->set('first', $results['current'][0]);
+ if (isset($results['current']) && count($results['current']) > 1) $tpl->set('runnerup', $results['current'][1]);
+ if (isset($results['development']) && count($results['development']) > 0) $tpl->set('upcoming', $results['development'][0]);
+
+
+
+
+ $sets = array();
+
+ $res = mysql_query("
+ SELECT
+ v.importance, IFNULL(v.nickname,v.name) AS name, b.grouped, b.variant, IFNULL(b.version,'') AS version, b.nickname, b.details, IF(ISNULL(b.release),DATE(NOW()),b.release) AS `release`, b.status, f.score
+ FROM
+ browserVersions AS b
+ LEFT JOIN browserVariants AS v ON (b.variant = v.id)
+ LEFT JOIN scores AS s ON (b.variant = s.variant AND (b.version = s.version OR (b.version IS NULL AND s.version IS NULL)))
+ LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
+ WHERE
+ (!ISNULL(b.release) OR b.status = 'development') AND
+ s.release = '" . $version . "' AND
+ FIND_IN_SET('" . $type . "',v.type) AND
+ !ISNULL(f.score)
+ ORDER BY
+ b.grouped, `release`
+ ");
+
+ echo mysql_error();
+
+ while ($row = mysql_fetch_object($res)) {
+ $sets[$row->grouped]['name'] = $row->grouped;
+ $sets[$row->grouped]['data'][] = $row;
+ }
+
+ $tpl->set('sets', $sets);
+
+ echo $tpl->fetch();
+ }
Oops, something went wrong.

0 comments on commit e11c04f

Please sign in to comment.