log next and previous site

This commit is contained in:
Ricsi
2017-03-13 20:02:12 +01:00
parent df179b7573
commit 5a8f7f0814
4 changed files with 104 additions and 12 deletions

View File

@@ -460,6 +460,35 @@ table.log tr.delete:hover {
cursor: pointer;
}
.navigator {
display: block;
text-align: center;
margin: 10px 0px;
}
.navigator img {
width: 40px;
}
.navigator div {
width: 100px;
display: inline-block;
}
.navigator .previous img {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
.grayscale {
opacity: 0.3;
filter: alpha(opacity=30); /* For IE8 and earlier */
}
@media (min-width: 680px) {

BIN
_image/previous.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,23 +1,44 @@
<?php
$log_count = $sql->num_of_rows("SELECT * FROM log ORDER BY log_date DESC;");
$previous_link = true;
$next_link = true;
if ($this->is_id()) {
# LOG DEATAILS
# LOG LIST FILTERED
//50esével megyünk
$from = ($this->get_id() - 1) * 50;
$log_query = "SELECT * FROM log ORDER BY log_date DESC LIMIT ".$from.",50;";
//echo $log_count;
if ($log_count <= $this->get_id()*50) {
$next_link = false;
}
$smarty->assign('next_id', ($next_link?$this->get_id()+1:false));
$smarty->assign('previous_id', ($this->get_id()>1?$this->get_id()-1:false));
}
else {
# LOG LIST
header("Location: /admin/log/1");
/*
$log_query = "SELECT * FROM log ORDER BY log_date DESC LIMIT 50;";
$log_assoc_array = $sql->assoc_array($log_query);
$log_array = array();
foreach ($log_assoc_array as $log_list_array) {
$current_log = new log();
$current_log->set_log_data_by_id($log_list_array['log_id']);
$log_array[] = $current_log;
}
$smarty->assign('log_array', $log_array);
$smarty->display('log.tpl');
$previous_link = false;
$smarty->assign('next_id', '2');
*/
}
$log_assoc_array = $sql->assoc_array($log_query);
$log_array = array();
foreach ($log_assoc_array as $log_list_array) {
$current_log = new log();
$current_log->set_log_data_by_id($log_list_array['log_id']);
$log_array[] = $current_log;
}
$smarty->assign('log_array', $log_array);
$smarty->display('log.tpl');
?>

View File

@@ -1,3 +1,24 @@
<div class="navigator">
<div class="previous">
{if $previous_id}
<a href="/admin/log/{$previous_id}">
{/if}
<img src="/_image/previous.png" {if !$previous_id}class="grayscale"{/if}>
{if $previous_id}
</a>
{/if}
</div>
<div class="next">
{if $next_id}
<a href="/admin/log/{$next_id}">
{/if}
<img src="/_image/previous.png">
{if $next_id}
</a>
{/if}
</div>
</div>
<div style="overflow-x:auto;">
<table class="log">
{foreach $log_array as $log}
@@ -19,3 +40,24 @@
</table>
</div>
<div class="navigator">
<div class="previous">
{if $previous_id}
<a href="/admin/log/{$previous_id}">
{/if}
<img src="/_image/previous.png" {if !$previous_id}class="grayscale"{/if}>
{if $previous_id}
</a>
{/if}
</div>
<div class="next">
{if $next_id}
<a href="/admin/log/{$next_id}">
{/if}
<img src="/_image/previous.png">
{if $next_id}
</a>
{/if}
</div>
</div>