added Log menu; log menu filter and buttons
This commit is contained in:
@@ -1,15 +1,45 @@
|
||||
<?php
|
||||
|
||||
$log_count = $sql->num_of_rows("SELECT * FROM log ORDER BY log_date DESC;");
|
||||
|
||||
//init
|
||||
$previous_link = true;
|
||||
$next_link = true;
|
||||
|
||||
$logc_list_query = "SELECT * FROM log_category ORDER BY logc_title ASC";
|
||||
$logc_assoc_array = $sql->assoc_array($logc_list_query);
|
||||
$log_categories = array();
|
||||
|
||||
$update = false;
|
||||
|
||||
//POST DATA HANDLER
|
||||
//ha létezik postolt logcategory és (nem létezik a cookie VAGY létezik de nem egyenlő az eddigivel)
|
||||
if (isset($_REQUEST['log_category']) && (!isset($_COOKIE['log_category']) || (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != $_REQUEST['log_category']))) {
|
||||
if ($_REQUEST['log_category'] != 'null') $condition = "WHERE log_log_category_logc_id = " . $_REQUEST['log_category'];
|
||||
//beállítjuk a cookie-t, rövid élettartammal
|
||||
setcookie("log_category", $_REQUEST['log_category'], time()+60*60, '/');
|
||||
$selected = $_REQUEST['log_category'];
|
||||
$update = true;
|
||||
}
|
||||
|
||||
//COOKIE HANDLER - igazából ide kell a condition leírása
|
||||
if (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != 'null' && !$update) {
|
||||
$condition = "WHERE log_log_category_logc_id = " . $_COOKIE['log_category'];
|
||||
$selected = $_COOKIE['log_category'];
|
||||
}
|
||||
|
||||
|
||||
foreach ($logc_assoc_array as $logc_array) {
|
||||
$new_logc = new log_category();
|
||||
$new_logc->set_logc_data_by_id($logc_array['logc_id']);
|
||||
$log_categories[] = $new_logc;
|
||||
}
|
||||
|
||||
|
||||
if ($this->is_id()) {
|
||||
# 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;";
|
||||
$log_query = "SELECT * FROM log " . (isset($condition)?$condition:"") . " ORDER BY log_date DESC LIMIT ".$from.",50;";
|
||||
$log_count = $sql->num_of_rows("SELECT * FROM log ".(isset($condition)?$condition:"")." ORDER BY log_date DESC;");
|
||||
//echo $log_count;
|
||||
if ($log_count <= $this->get_id()*50) {
|
||||
$next_link = false;
|
||||
@@ -38,6 +68,8 @@ foreach ($log_assoc_array as $log_list_array) {
|
||||
|
||||
|
||||
|
||||
$smarty->assign('selected', $selected);
|
||||
$smarty->assign('logc_array', $log_categories);
|
||||
$smarty->assign('log_array', $log_array);
|
||||
$smarty->display('log.tpl');
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ if ($this->is_id()) {
|
||||
$smarty->assign('backups', $backups);
|
||||
}
|
||||
|
||||
elseif ($new_setting->get_setv_setting()->get_set_setting_type_st_id() == 3) {
|
||||
//url -> hozzáfűzi az admin után a varcharban lévő url-t
|
||||
header('Location: /admin/' . $new_setting->get_setv_varchar());
|
||||
}
|
||||
|
||||
|
||||
|
||||
$smarty->assign("setting", $new_setting);
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post" action="/admin/log/1" id="logc_form">
|
||||
<div>
|
||||
<select name="log_category" id="log_category">
|
||||
<option value="null">Összes log</option>
|
||||
{foreach $logc_array as $logc}
|
||||
<option value="{$logc->get_logc_id()}"{if $logc->get_logc_id()==$selected} selected{/if}>{$logc->get_logc_title()}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="navigator">
|
||||
<div class="previous">
|
||||
{if $previous_id}
|
||||
@@ -12,7 +25,7 @@
|
||||
{if $next_id}
|
||||
<a href="/admin/log/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png">
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale"{/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
@@ -55,9 +68,15 @@
|
||||
{if $next_id}
|
||||
<a href="/admin/log/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png">
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale"{/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#log_category").change(function() {
|
||||
$("#logc_form").submit();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user