diff options
Diffstat (limited to 'mod/logbrowser')
-rw-r--r-- | mod/logbrowser/index.php | 126 | ||||
-rw-r--r-- | mod/logbrowser/languages/en.php | 14 | ||||
-rw-r--r-- | mod/logbrowser/start.php | 44 | ||||
-rw-r--r-- | mod/logbrowser/views/default/logbrowser/adminlinks.php | 6 | ||||
-rw-r--r-- | mod/logbrowser/views/default/logbrowser/form.php | 130 | ||||
-rw-r--r-- | mod/logbrowser/views/default/object/logwrapper.php | 94 |
6 files changed, 207 insertions, 207 deletions
diff --git a/mod/logbrowser/index.php b/mod/logbrowser/index.php index 975173700..18a15bfa4 100644 --- a/mod/logbrowser/index.php +++ b/mod/logbrowser/index.php @@ -1,66 +1,66 @@ -<?php
- /**
- * Elgg log browser.
- *
- * @package ElggLogBrowser
+<?php + /** + * Elgg log browser. + * + * @package ElggLogBrowser - * @author Curverider Ltd
+ * @author Curverider Ltd + + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + admin_gatekeeper(); + set_context('admin'); + // Set admin user for user block + set_page_owner($_SESSION['guid']); + + + $limit = get_input('limit', 40); + $offset = get_input('offset'); + + $search_username = get_input('search_username'); + if ($search_username) { + if ($user = get_user_by_username($search_username)) { + $user = $user->guid; + } + } else { + $user_guid = get_input('user_guid',0); + if ($user_guid) { + $user = (int) $user_guid; + } else { + $user = ""; + } + } + + $timelower = get_input('timelower'); + if ($timelower) $timelower = strtotime($timelower); + $timeupper = get_input('timeupper'); + if ($timeupper) $timeupper = strtotime($timeupper); + + $title = elgg_view_title(elgg_echo('logbrowser')); + + // Get log entries + $log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); + $count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); + $log_entries = array(); + + foreach ($log as $l) + { + $tmp = new ElggObject(); + $tmp->subtype = 'logwrapper'; + $tmp->entry = $l; + $log_entries[] = $tmp; + } + + $form = elgg_view('logbrowser/form',array('user_guid' => $user, 'timeupper' => $timeupper, 'timelower' => $timelower)); + + set_context('search'); + $result = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false); + set_context('admin'); + +// Display main admin menu + page_draw(elgg_echo('logbrowser'),elgg_view_layout("two_column_left_sidebar", '', $title . $form . $result)); - * @link http://elgg.com/
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- admin_gatekeeper();
- set_context('admin');
- // Set admin user for user block
- set_page_owner($_SESSION['guid']);
-
-
- $limit = get_input('limit', 40);
- $offset = get_input('offset');
-
- $search_username = get_input('search_username');
- if ($search_username) {
- if ($user = get_user_by_username($search_username)) {
- $user = $user->guid;
- }
- } else {
- $user_guid = get_input('user_guid',0);
- if ($user_guid) {
- $user = (int) $user_guid;
- } else {
- $user = "";
- }
- }
-
- $timelower = get_input('timelower');
- if ($timelower) $timelower = strtotime($timelower);
- $timeupper = get_input('timeupper');
- if ($timeupper) $timeupper = strtotime($timeupper);
-
- $title = elgg_view_title(elgg_echo('logbrowser'));
-
- // Get log entries
- $log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
- $count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
- $log_entries = array();
-
- foreach ($log as $l)
- {
- $tmp = new ElggObject();
- $tmp->subtype = 'logwrapper';
- $tmp->entry = $l;
- $log_entries[] = $tmp;
- }
-
- $form = elgg_view('logbrowser/form',array('user_guid' => $user, 'timeupper' => $timeupper, 'timelower' => $timelower));
-
- set_context('search');
- $result = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
- set_context('admin');
-
-// Display main admin menu
- page_draw(elgg_echo('logbrowser'),elgg_view_layout("two_column_left_sidebar", '', $title . $form . $result));
-
?>
\ No newline at end of file diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php index a100e7ff7..aa06edd9a 100644 --- a/mod/logbrowser/languages/en.php +++ b/mod/logbrowser/languages/en.php @@ -14,13 +14,13 @@ */ 'logbrowser' => 'Log browser', - 'logbrowser:browse' => 'Browse system log',
- 'logbrowser:search' => 'Refine results',
- 'logbrowser:user' => 'Username to search by',
- 'logbrowser:starttime' => 'Beginning time (for example "last monday", "1 hour ago")',
- 'logbrowser:endtime' => 'End time',
-
- 'logbrowser:explore' => 'Explore log',
+ 'logbrowser:browse' => 'Browse system log', + 'logbrowser:search' => 'Refine results', + 'logbrowser:user' => 'Username to search by', + 'logbrowser:starttime' => 'Beginning time (for example "last monday", "1 hour ago")', + 'logbrowser:endtime' => 'End time', + + 'logbrowser:explore' => 'Explore log', ); diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 52e1f8617..47a78c243 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -16,28 +16,28 @@ global $CONFIG; // Register a page handler, so we can have nice URLs - register_page_handler('logbrowser','logbrowser_page_handler');
-
- // Extend CSS
- extend_view('css','logbrowser/css');
-
- // Extend context menu with admin logbrowsre link
- if (isadminloggedin())
- {
- extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
+ register_page_handler('logbrowser','logbrowser_page_handler'); + + // Extend CSS + extend_view('css','logbrowser/css'); + + // Extend context menu with admin logbrowsre link + if (isadminloggedin()) + { + extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000); } - }
-
- /**
- * Adding the log browser to the admin menu
- *
- */
- function logbrowser_pagesetup()
- {
- if (get_context() == 'admin' && isadminloggedin()) {
- global $CONFIG;
- add_submenu_item(elgg_echo('logbrowser'), $CONFIG->wwwroot . 'pg/logbrowser/');
- }
+ } + + /** + * Adding the log browser to the admin menu + * + */ + function logbrowser_pagesetup() + { + if (get_context() == 'admin' && isadminloggedin()) { + global $CONFIG; + add_submenu_item(elgg_echo('logbrowser'), $CONFIG->wwwroot . 'pg/logbrowser/'); + } } /** @@ -56,6 +56,6 @@ // Initialise log browser - register_elgg_event_handler('init','system','logbrowser_init');
+ register_elgg_event_handler('init','system','logbrowser_init'); register_elgg_event_handler('pagesetup','system','logbrowser_pagesetup'); ?>
\ No newline at end of file diff --git a/mod/logbrowser/views/default/logbrowser/adminlinks.php b/mod/logbrowser/views/default/logbrowser/adminlinks.php index abe83707d..e84e385ed 100644 --- a/mod/logbrowser/views/default/logbrowser/adminlinks.php +++ b/mod/logbrowser/views/default/logbrowser/adminlinks.php @@ -1,4 +1,4 @@ -<?php
-
-?>
+<?php + +?> <a href="<?php echo $vars['url']; ?>mod/logbrowser/?user_guid=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("logbrowser:explore"); ?></a>
\ No newline at end of file diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php index 2b0c78720..4a1e40d6a 100644 --- a/mod/logbrowser/views/default/logbrowser/form.php +++ b/mod/logbrowser/views/default/logbrowser/form.php @@ -1,66 +1,66 @@ -
-<div id="logbrowser_search_area">
-<?php
-
- // Time lower limit
-
- if ($vars['timelower']) {
- $lowerval = date('r',$vars['timelower']);
- } else {
- $lowerval = "";
- }
- if ($vars['timeupper']) {
- $upperval = date('r',$vars['timeupper']);
- } else {
- $upperval = "";
- }
- if ($vars['user_guid']) {
- if ($user = get_entity($vars['user_guid']))
- $userval = $user->username;
- } else {
- $userval = "";
- }
-
-
- $form = "";
-
- $form .= "<p>" . elgg_echo('logbrowser:user');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'search_username',
- 'value' => $userval
- )) . "</p>";
-
- $form .= "<p>" . elgg_echo('logbrowser:starttime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timelower',
- 'value' => $lowerval
- )) . "</p>";
-
- $form .= "<p>" . elgg_echo('logbrowser:endtime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timeupper',
- 'value' => $upperval
- )) . "</p>";
- $form .= elgg_view('input/submit',array(
- 'value' => elgg_echo('search')
- ));
-
- $wrappedform = elgg_view('input/form',array(
- 'body' => $form,
- 'method' => 'get',
- 'action' => $vars['url'] . "mod/logbrowser/"
- ));
-
- if ($upperval || $lowerval || $userval) {
- $hidden = "";
- } else {
- $hidden = "style=\"display:none\"";
- }
-
-?>
-
- <div id="logbrowserSearchform" <?php echo $hidden; ?>><?php echo $wrappedform; ?></div>
- <p>
- <a href="#" onclick="$('#logbrowserSearchform').toggle()"><?php echo elgg_echo('logbrowser:search'); ?></a>
- </p>
+ +<div id="logbrowser_search_area"> +<?php + + // Time lower limit + + if ($vars['timelower']) { + $lowerval = date('r',$vars['timelower']); + } else { + $lowerval = ""; + } + if ($vars['timeupper']) { + $upperval = date('r',$vars['timeupper']); + } else { + $upperval = ""; + } + if ($vars['user_guid']) { + if ($user = get_entity($vars['user_guid'])) + $userval = $user->username; + } else { + $userval = ""; + } + + + $form = ""; + + $form .= "<p>" . elgg_echo('logbrowser:user'); + $form .= elgg_view('input/text',array( + 'internalname' => 'search_username', + 'value' => $userval + )) . "</p>"; + + $form .= "<p>" . elgg_echo('logbrowser:starttime'); + $form .= elgg_view('input/text',array( + 'internalname' => 'timelower', + 'value' => $lowerval + )) . "</p>"; + + $form .= "<p>" . elgg_echo('logbrowser:endtime'); + $form .= elgg_view('input/text',array( + 'internalname' => 'timeupper', + 'value' => $upperval + )) . "</p>"; + $form .= elgg_view('input/submit',array( + 'value' => elgg_echo('search') + )); + + $wrappedform = elgg_view('input/form',array( + 'body' => $form, + 'method' => 'get', + 'action' => $vars['url'] . "mod/logbrowser/" + )); + + if ($upperval || $lowerval || $userval) { + $hidden = ""; + } else { + $hidden = "style=\"display:none\""; + } + +?> + + <div id="logbrowserSearchform" <?php echo $hidden; ?>><?php echo $wrappedform; ?></div> + <p> + <a href="#" onclick="$('#logbrowserSearchform').toggle()"><?php echo elgg_echo('logbrowser:search'); ?></a> + </p> </div>
\ No newline at end of file diff --git a/mod/logbrowser/views/default/object/logwrapper.php b/mod/logbrowser/views/default/object/logwrapper.php index bae5d4240..923ce7c52 100644 --- a/mod/logbrowser/views/default/object/logwrapper.php +++ b/mod/logbrowser/views/default/object/logwrapper.php @@ -1,50 +1,50 @@ -<?php
- /**
- * Elgg log browser.
- *
- * @package ElggLogBrowser
+<?php + /** + * Elgg log browser. + * + * @package ElggLogBrowser - * @author Curverider Ltd
+ * @author Curverider Ltd - * @link http://elgg.com/
- */
-
- $entry = $vars['entity']->entry;
-
- $by = get_entity($entry->performed_by_guid);
- $object = get_object_from_log_entry($entry->id);
-
- if (is_callable(array($object, 'getURL')))
- $obj_url = $object->getURL();
-
- //echo elgg_view_listing($icon, $info);
-?>
- <table class="log_entry">
- <tr>
- <td class="log_entry_time">
- <?php echo date('r', $entry->time_created ); ?>
- </td>
- <td class="log_entry_user">
- <?php if ($by) {
- echo "<a href=\"".$by->getURL()."\">{$by->name}</a>";
- echo " <a href=\"?user_guid={$by->guid}\">" . $by->guid . "</a>";
- }
- else echo " "; ?>
- <td>
- <td class="log_entry_item">
- <?php
- if ($obj_url) echo "<a href=\"$obj_url\">";
- echo "{$entry->object_class}";
- if ($obj_url) echo "</a>";
- echo " " . $entry->object_id;
-
- ?>
- </td>
- <td class="log_entry_action">
- <div class="log_entry_action_<?php echo $entry->event; ?>">
- <?php echo elgg_echo($entry->event); ?>
- </div>
- </td>
- </tr>
- </table>
+ * @link http://elgg.com/ + */ + + $entry = $vars['entity']->entry; + + $by = get_entity($entry->performed_by_guid); + $object = get_object_from_log_entry($entry->id); + + if (is_callable(array($object, 'getURL'))) + $obj_url = $object->getURL(); + + //echo elgg_view_listing($icon, $info); +?> + <table class="log_entry"> + <tr> + <td class="log_entry_time"> + <?php echo date('r', $entry->time_created ); ?> + </td> + <td class="log_entry_user"> + <?php if ($by) { + echo "<a href=\"".$by->getURL()."\">{$by->name}</a>"; + echo " <a href=\"?user_guid={$by->guid}\">" . $by->guid . "</a>"; + } + else echo " "; ?> + <td> + <td class="log_entry_item"> + <?php + if ($obj_url) echo "<a href=\"$obj_url\">"; + echo "{$entry->object_class}"; + if ($obj_url) echo "</a>"; + echo " " . $entry->object_id; + + ?> + </td> + <td class="log_entry_action"> + <div class="log_entry_action_<?php echo $entry->event; ?>"> + <?php echo elgg_echo($entry->event); ?> + </div> + </td> + </tr> + </table>
\ No newline at end of file |