aboutsummaryrefslogtreecommitdiff
path: root/mod/logbrowser/views/default/logbrowser/table.php
blob: b08a0c428c6dfb047693547306c588faabac8545 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
 * Log browser table
 *
 * @package ElggLogBrowser
 */

$log_entries = $vars['log_entries'];
?>

<table class="elgg-table">
	<tr>
		<th><?php echo elgg_echo('logbrowser:date'); ?></th>
		<th><?php echo elgg_echo('logbrowser:ip_address'); ?></th>
		<th><?php echo elgg_echo('logbrowser:user:name'); ?></th>
		<th><?php echo elgg_echo('logbrowser:user:guid'); ?></th>
		<th><?php echo elgg_echo('logbrowser:object'); ?></th>
		<th><?php echo elgg_echo('logbrowser:object:guid'); ?></th>
		<th><?php echo elgg_echo('logbrowser:action'); ?></th>
	</tr>
<?php
	$alt = '';
	foreach ($log_entries as $entry) {
		if ($entry->ip_address) {
			$ip_address = $entry->ip_address;
		} else {
			$ip_address = '&nbsp;';
		}

		$user = get_entity($entry->performed_by_guid);
		if ($user) {
			$user_link = elgg_view('output/url', array(
				'href' => $user->getURL(),
				'text' => $user->name,
				'is_trusted' => true,
			));
			$user_guid_link = elgg_view('output/url', array(
				'href' => "admin/administer_utilities/logbrowser?user_guid={$user->guid}",
				'text' => $user->getGUID(),
				'is_trusted' => true,
			));
		} else {
			$user_guid_link = $user_link = '&nbsp;';
		}

		$object = get_object_from_log_entry($entry->id);
		if (is_callable(array($object, 'getURL'))) {
			$object_link = elgg_view('output/url', array(
				'href' => $object->getURL(),
				'text' => $entry->object_class,
				'is_trusted' => true,
			));
		} else {
			$object_link = $entry->object_class;
		}
?>
	<tr <?php echo $alt; ?>>
		<td class="log-entry-time">
			<?php echo date('r', $entry->time_created); ?>
		</td>
		<td class="log-entry-ip-address">
			<?php echo $ip_address; ?>
		</td>
		<td class="log-entry-user">
			<?php echo $user_link; ?>
		</td>
		<td class="log-entry-guid">
			<?php echo $user_guid_link; ?>
		</td>
		<td class="log-entry-object">
			<?php echo $object_link; ?>
		</td>
		<td class="log-entry-guid">
			<?php echo $entry->object_id; ?>
		</td>
		<td class="log-entry-action">
			<?php echo elgg_echo($entry->event); ?>
		</td>
	</tr>
<?php

		$alt = $alt ? '' : 'class="alt"';
	}
?>
</table>
<?php
if (!$log_entries) {
	echo elgg_echo('logbrowser:no_result');
	return true;
}