diff options
Diffstat (limited to 'mod/logbrowser/views/default')
3 files changed, 27 insertions, 15 deletions
diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php index 89894e3d2..9506c9d9f 100644 --- a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -15,11 +15,17 @@ if ($search_username) { $user = get_user_by_username($search_username); if ($user) { $user_guid = $user->guid; + } else { + $user_guid = null; } } else { $user_guid = get_input('user_guid', null); if ($user_guid) { $user_guid = (int) $user_guid; + $user = get_entity($user_guid); + if ($user) { + $search_username = $user->username; + } } else { $user_guid = null; } @@ -38,9 +44,10 @@ if ($timeupper) { $ip_address = get_input('ip_address'); $refine = elgg_view('logbrowser/refine', array( - 'user_guid' => $user_guid, 'timeupper' => $timeupper, 'timelower' => $timelower, + 'ip_address' => $ip_address, + 'username' => $search_username, )); // Get log entries @@ -49,6 +56,12 @@ $log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeup $count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower, 0, $ip_address); +// if user does not exist, we have no results +if ($search_username && is_null($user_guid)) { + $log = false; + $count = 0; +} + $table = elgg_view('logbrowser/table', array('log_entries' => $log)); $nav = elgg_view('navigation/pagination',array( diff --git a/mod/logbrowser/views/default/forms/logbrowser/refine.php b/mod/logbrowser/views/default/forms/logbrowser/refine.php index 6ec5907b6..ebf7f10ed 100644 --- a/mod/logbrowser/views/default/forms/logbrowser/refine.php +++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php @@ -3,35 +3,29 @@ * Form body for refining the log browser search. * Look for a particular person or in a time window. * - * @uses $vars['user_guid'] + * @uses $vars['username'] + * @uses $vars['ip_address'] * @uses $vars['timelower'] * @uses $vars['timeupper'] */ if (isset($vars['timelower'])) { - $lowerval = date('r',$vars['timelower']); + $lowerval = date('r', $vars['timelower']); } else { $lowerval = ""; } if (isset($vars['timeupper'])) { - $upperval = date('r',$vars['timeupper']); + $upperval = date('r', $vars['timeupper']); } else { $upperval = ""; } -if (isset($vars['user_guid'])) { - $user = get_entity($vars['user_guid']); - if ($user) { - $userval = $user->username; - } -} else { - $userval = ""; -} -$ip_address = elgg_extract('ip_address', ''); +$ip_address = elgg_extract('ip_address', $vars); +$username = elgg_extract('username', $vars); $form = "<div>" . elgg_echo('logbrowser:user'); $form .= elgg_view('input/text', array( 'name' => 'search_username', - 'value' => $userval, + 'value' => $username, )) . "</div>"; $form .= "<div>" . elgg_echo('logbrowser:ip_address'); diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php index 9a867e080..1223c1456 100644 --- a/mod/logbrowser/views/default/logbrowser/table.php +++ b/mod/logbrowser/views/default/logbrowser/table.php @@ -82,4 +82,9 @@ $log_entries = $vars['log_entries']; $alt = $alt ? '' : 'class="alt"'; } ?> -</table>
\ No newline at end of file +</table> +<?php +if (!$log_entries) { + echo elgg_echo('logbrowser:no_result'); + return true; +} |