mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-29 10:49:22 +02:00
* (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:
parent
036520566c
commit
d9675b1bc6
BIN
images/changelog/unknown.png
Normal file
BIN
images/changelog/unknown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 797 B |
@ -93,6 +93,7 @@ else {
|
|||||||
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
||||||
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
|
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
|
||||||
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
|
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
|
||||||
|
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||||
|
@ -155,6 +155,7 @@ CREATE TABLE `myaac_menu`
|
|||||||
/* MENU_CATEGORY_NEWS kathrine */
|
/* MENU_CATEGORY_NEWS kathrine */
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
|
||||||
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Changelog', 'changelog', 1, 2);
|
||||||
/* MENU_CATEGORY_ACCOUNT kathrine */
|
/* MENU_CATEGORY_ACCOUNT kathrine */
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
|
||||||
|
@ -18,6 +18,7 @@ CREATE TABLE `myaac_menu`
|
|||||||
/* MENU_CATEGORY_NEWS kathrine */
|
/* MENU_CATEGORY_NEWS kathrine */
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0);
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'News Archive', 'news/archive', 1, 1);
|
||||||
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Changelog', 'changelog', 1, 2);
|
||||||
/* MENU_CATEGORY_ACCOUNT kathrine */
|
/* MENU_CATEGORY_ACCOUNT kathrine */
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Account Management', 'account/manage', 2, 0);
|
||||||
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
|
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Create Account', 'account/create', 2, 1);
|
||||||
|
@ -15,66 +15,32 @@ $id = isset($_GET['id']) ? $_GET['id'] : 0;
|
|||||||
$limit = 30;
|
$limit = 30;
|
||||||
$offset = $_page * $limit;
|
$offset = $_page * $limit;
|
||||||
$next_page = false;
|
$next_page = false;
|
||||||
?>
|
|
||||||
|
|
||||||
<br/>
|
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` WHERE `hidden` = 0 ORDER BY `id` DESC LIMIT ' . ($limit + 1) . ' OFFSET ' . $offset)->fetchAll();
|
||||||
<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 ' . $db->tableName(TABLE_PREFIX . 'changelog') . ' ORDER BY ' . $db->fieldName('id') . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset);
|
$i = 0;
|
||||||
if(!$changelogs->rowCount())
|
foreach($changelogs as $key => &$log)
|
||||||
{
|
{
|
||||||
?>
|
if($i < $limit) {
|
||||||
<tr>
|
$log['type'] = getChangelogType($log['type']);
|
||||||
<td bgcolor="<?php echo $config['lightborder']; ?>">There are no change logs for the moment.</td>
|
$log['where'] = getChangelogWhere($log['where']);
|
||||||
</tr>
|
}
|
||||||
<?php
|
else {
|
||||||
return;
|
unset($changelogs[$key]);
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<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)
|
if ($i >= $limit)
|
||||||
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=changelog&page=' . ($_page + 1) . '" class="size_xxs">Next Page</a></td></tr>';
|
$next_page = true;
|
||||||
?>
|
|
||||||
</table>
|
$i++;
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
echo $twig->render('changelog.html.twig', array(
|
||||||
</table>
|
'changelogs' => $changelogs,
|
||||||
<?php
|
'page' => $_page,
|
||||||
|
'next_page' => $next_page,
|
||||||
|
));
|
||||||
|
|
||||||
function getChangelogType($v)
|
function getChangelogType($v)
|
||||||
{
|
{
|
||||||
switch($v) {
|
switch($v) {
|
||||||
@ -88,7 +54,7 @@ function getChangelogType($v)
|
|||||||
return 'fixed';
|
return 'fixed';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Unknown type';
|
return 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChangelogWhere($v)
|
function getChangelogWhere($v)
|
||||||
@ -100,6 +66,6 @@ function getChangelogWhere($v)
|
|||||||
return 'website';
|
return 'website';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Unknown where';
|
return 'unknown';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
38
system/templates/changelog.html.twig
Normal file
38
system/templates/changelog.html.twig
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<br/>
|
||||||
|
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||||
|
<tr bgcolor="{{ 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>
|
||||||
|
{% if changelogs|length > 0%}
|
||||||
|
{% set i = 0 %}
|
||||||
|
{% for log in changelogs %}
|
||||||
|
<tr bgcolor="{{ getStyle(i) }}">
|
||||||
|
<td align="center">
|
||||||
|
<img src="images/changelog/{{ log.type }}.png" title="{{ log.type|capitalize }}"/>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<img src="images/changelog/{{ log.where }}.png" title="{{ log.where|capitalize }}"/>
|
||||||
|
</td>
|
||||||
|
<td>{{ log.date|date("j.m.Y") }}</td>
|
||||||
|
<td>{{ log.body|raw }}</td>
|
||||||
|
</tr>
|
||||||
|
{% set i = i + 1 %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td bgcolor="{{ config.lightborder }}">There are no change logs for the moment.</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||||
|
{% if page > 0 %}
|
||||||
|
<tr><td width="100%" align="right" valign="bottom"><a href="{{ getLink('changelog/' ~ (page - 1)) }}" class="size_xxs">Previous Page</a></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if next_page %}
|
||||||
|
<tr><td width="100%" align="right" valign="bottom"><a href="{{ getLink('changelog/' ~ (page + 1)) }}" class="size_xxs">Next Page</a></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
</table>
|
Loading…
x
Reference in New Issue
Block a user