mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-11-09 23:06:45 +00:00
Show versions without OTA in different style.
This commit is contained in:
parent
c8dd58aab1
commit
3de1b94816
@ -22,3 +22,7 @@ td.empty {
|
||||
tr:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
td.fullonly {
|
||||
color: #88f;
|
||||
}
|
||||
|
@ -33,9 +33,14 @@ foreach ($allVars as $family => $models) {
|
||||
foreach ($variants as $ref => $name) {
|
||||
echo '<tr><td class="ref">' . $ref . '</td>';
|
||||
$refVersions = $db->getAllVersionsForRef($ref);
|
||||
$allOta = $db->getAllVersionsForRef($ref, $db::OTA_ONLY);
|
||||
foreach ($allVersions as $v) {
|
||||
if (in_array($v, $refVersions, true)) {
|
||||
echo '<td>' . $v . '</td>';
|
||||
if (in_array($v, $allOta)) {
|
||||
echo '<td>' . $v . '</td>';
|
||||
} else {
|
||||
echo '<td class="fullonly">' . $v . '</td>';
|
||||
}
|
||||
} else {
|
||||
echo '<td class="empty">- - -</td>';
|
||||
}
|
||||
|
@ -117,14 +117,23 @@ class SQLiteReader
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getAllVersionsForRef($ref = null)
|
||||
public function getAllVersionsForRef($ref = null, $which = self::BOTH)
|
||||
{
|
||||
$sql = 'SELECT fv, tv FROM updates u LEFT JOIN files f ON u.file_sha1=f.sha1';
|
||||
$where_arr = array();
|
||||
$params_arr = array();
|
||||
if (!is_null($ref)) {
|
||||
$sql .= ' WHERE curef=?';
|
||||
$where_arr[] = 'curef=?';
|
||||
$params_arr[] = $ref;
|
||||
}
|
||||
if ($which == self::OTA_ONLY) {
|
||||
$where_arr[] = 'fv IS NOT null';
|
||||
} elseif ($which == self::FULL_ONLY) {
|
||||
$where_arr[] = 'fv IS null';
|
||||
}
|
||||
if (count($where_arr) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' AND ', $where_arr);
|
||||
}
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$ok = $stmt->execute($params_arr);
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
Loading…
Reference in New Issue
Block a user