* (internal) moved changelog to twig

* added changelog menu item to kathrine template
* (fix) if changelog type or where is set to 0 then display as unknown
This commit is contained in:
slawkens1
2017-11-23 17:55:42 +01:00
parent 036520566c
commit d9675b1bc6
6 changed files with 62 additions and 55 deletions

View File

@@ -15,66 +15,32 @@ $id = isset($_GET['id']) ? $_GET['id'] : 0;
$limit = 30;
$offset = $_page * $limit;
$next_page = false;
?>
<br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td width="22"><font class="white"><b>Type</b></font></td>
<td width="22"><font class="white"><b>Where</b></font></td>
<td width="50"><font class="white"><b>Date</b></font></td>
<td><font class="white"><b>Description</b></font></td>
</tr>
<?php
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` WHERE `hidden` = 0 ORDER BY `id` DESC LIMIT ' . ($limit + 1) . ' OFFSET ' . $offset)->fetchAll();
$changelogs = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'changelog') . ' ORDER BY ' . $db->fieldName('id') . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset);
if(!$changelogs->rowCount())
$i = 0;
foreach($changelogs as $key => &$log)
{
?>
<tr>
<td bgcolor="<?php echo $config['lightborder']; ?>">There are no change logs for the moment.</td>
</tr>
<?php
return;
}
else
{
$i = 0;
foreach($changelogs as $log)
{
$type = getChangelogType($log['type']);
$where = getChangelogWhere($log['where']);
?>
<tr bgcolor="<?php echo getStyle($i++); ?>">
<td align="center">
<img src="images/changelog/<?php echo $type; ?>.png" title="<?php echo ucfirst($type); ?>"/>
</td>
<td align="center">
<img src="images/changelog/<?php echo $where; ?>.png" title="<?php echo ucfirst($where); ?>"/>
</td>
<td><?php echo date("j.m.Y", $log['date']); ?></td>
<td><?php echo $log['body']; ?></td>
</tr>
<?php
if ($i >= $limit)
$next_page = true;
if($i < $limit) {
$log['type'] = getChangelogType($log['type']);
$log['where'] = getChangelogWhere($log['where']);
}
else {
unset($changelogs[$key]);
}
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<?php
if($_page > 0)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=changelog&page=' . ($_page - 1) . '" class="size_xxs">Previous Page</a></td></tr>';
if($next_page)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=changelog&page=' . ($_page + 1) . '" class="size_xxs">Next Page</a></td></tr>';
?>
</table>
<?php
if ($i >= $limit)
$next_page = true;
$i++;
}
?>
</table>
<?php
echo $twig->render('changelog.html.twig', array(
'changelogs' => $changelogs,
'page' => $_page,
'next_page' => $next_page,
));
function getChangelogType($v)
{
switch($v) {
@@ -88,7 +54,7 @@ function getChangelogType($v)
return 'fixed';
}
return 'Unknown type';
return 'unknown';
}
function getChangelogWhere($v)
@@ -100,6 +66,6 @@ function getChangelogWhere($v)
return 'website';
}
return 'Unknown where';
return 'unknown';
}
?>