Просмотр файла wu-admin/activity.php

Размер файла: 3.7Kb
<?php
require_once('../wu-engine/wu_init.php');
$page_name = 'Активность';
$page_keys = 'активность';
$page_desc = 'Активность пользователей';
$prevurl_1 = '/'.ADMINPATH.'/';
$prevname_1 = 'Панель управления';
$online_title = 'В панели управления';
$online_url = '/';
$page_right = '<div class="header-buttons"><div class="collapse" id="header-buttons"><div class="well"><a data-toggle="modal" role="button" href="#modal_clear" class="btn btn-primary">Очистить</a></div></div></div>';
include('../wu-engine/wu_header.php');
include('../wu-engine/wu-functions/wu_pagination.php');
include('../wu-engine/wu-functions/wu_functions.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
mysqli_query($connect_db, "UPDATE ".DB_PREFIX."_adm_act SET new = '0' WHERE new = '1'");
?>

<div id="modal_clear" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-remove"></i> Очистка активности</h4>
</div>
<div class="modal-body with-padding">
<div class="alert alert-danger"><center>Внимание! История активности будет очищена.</center></div>
</div>
<div class="modal-footer">
<label style="margin-right: 5px;">
<input type="checkbox" class="styled" id="tolog" />
Сохранить в лог
</label>
<button type="button" id="act_clear" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Очищаем">Очистить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>

<?php
if (isset($_GET['user'])) {
$usr = intval($_GET['user']);
$wu_dop = "WHERE usr = '$usr'";
} else { $wu_dop = ''; }
$num = 20; //Сколько выводить на странице
if (isset($_GET['page'])) { $page = intval($_GET['page']); if ($page == 0) { $page = 1; } } else { $page = 1; }
$qu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `c` FROM `".DB_PREFIX."_adm_act` $wu_dop"));
$co = $qu['c'];
$total = intval(($co - 1) / $num) + 1;
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$qr = mysqli_query($connect_db, "SELECT id,usr,ty,msg,dt,log FROM `".DB_PREFIX."_adm_act` INNER JOIN ".DB_PREFIX."_users ON ".DB_PREFIX."_adm_act.usr = ".DB_PREFIX."_users.uid $wu_dop ORDER BY id DESC LIMIT $start, $num");
if ($co > 0) {
while($row = mysqli_fetch_assoc($qr)) {
$ty = $row['ty'];
?>
<div class="fulln">
<span class="alert-notice"><?php echo wudatenorm($row['dt']); ?></span>
<div class="alert alert-<?php if($ty == 0) { echo 'success'; } if($ty == 1) { echo 'warning'; } if($ty == 2) { echo 'danger'; } ?> fade in block-inner">
<a href="/<?php echo ADMINPATH; ?>/activity?user=<?php echo $row['usr']; ?>"><?php echo $row['log']; ?></a> | <?php echo $row['msg']; ?>
</div></div>
<?php
}
$pageNav = new SimPageNav();
$pages = ceil($co/$num);
echo $pageNav->getLinks($pages, 1, $page, 10, 'page');
} else { echo '<div class="alert alert-info fade in"><i class="icon-info"></i> Нет активности</div>'; }
?>

<script type="text/javascript">
//Очистка активности
$('#act_clear').click(function(){
var tolog = $('#tolog').prop('checked');
var data = {'tolog': tolog};
wu_response('/wu-engine/wu-actions/adm_activity_clear.php', data, 'act_clear', '1', function(wu_result) {
if (wu_result == '1') {
$(location).attr('href','/<?php echo ADMINPATH; ?>/activity');
}
});
});
</script>

<?php include('../wu-engine/wu_footer.php'); ?>