summaryrefslogtreecommitdiff
path: root/admin/action_logs.php
blob: 3d40ff29ce1130efdd9e0ea7ba5cfe3655196278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use Bitweaver\KernelTools;
use Bitweaver\Liberty\LibertyContent;
require_once '../../kernel/includes/setup_inc.php';
include_once KERNEL_PKG_INCLUDE_PATH.'simple_form_functions_lib.php';

$gBitSystem->verifyPermission( 'p_admin' );

$gContent = new LibertyContent();

// logging options
$logSettings = [
	'liberty_action_log' => [
		'label' => 'Action Logs',
		'note'  => 'Log all changes made to liberty content.',
		'type'  => 'toggle',
		'page'  => 'page tag',
	],
];
$gBitSmarty->assign( 'logSettings', $logSettings );

// form processing
if( !empty( $_REQUEST['apply_settings'] ) ) {
	$settings = array_merge( $logSettings );
	foreach( array_keys( $settings ) as $item ) {
		simple_set_toggle( $item, LIBERTY_PKG_NAME );
	}
	if( !empty( $_REQUEST['log_prune'] ) ) {
		$gContent->expungeActionLog( $_REQUEST['log_prune'] );
	}
}

// get list of log entries
$listHash = $_REQUEST;
// since this is all just text and we don't want to search through hundreds of pages
$listHash['max_records'] = $gBitSystem->getConfig( 'max_records', 10 ) * 5;
$actionLogs = $gContent->getActionLogs( $listHash );
$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
$gBitSmarty->assign( 'actionLogs', $actionLogs );

$gBitSystem->display( 'bitpackage:liberty/action_logs.tpl', KernelTools::tra( 'Action Logs' ) , [ 'display_mode' => 'admin' ]);