aboutsummaryrefslogtreecommitdiff
path: root/mod/logbrowser/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/logbrowser/views')
-rw-r--r--mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php14
-rw-r--r--mod/logbrowser/views/default/forms/logbrowser/refine.php15
-rw-r--r--mod/logbrowser/views/default/logbrowser/table.php7
3 files changed, 23 insertions, 13 deletions
diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
index 2581f954c..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,10 +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
@@ -50,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 3c6528d21..ebf7f10ed 100644
--- a/mod/logbrowser/views/default/forms/logbrowser/refine.php
+++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php
@@ -3,10 +3,10 @@
* 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']
- * @uses $vars['ip_address']
*/
if (isset($vars['timelower'])) {
@@ -19,20 +19,13 @@ if (isset($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', $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;
+}