diff options
-rw-r--r-- | admin/users.php | 22 | ||||
-rw-r--r-- | templates/show_admin_tools.inc.php | 1 | ||||
-rw-r--r-- | templates/show_users.inc.php | 26 |
3 files changed, 49 insertions, 0 deletions
diff --git a/admin/users.php b/admin/users.php index bb4296a3..aa4196b0 100644 --- a/admin/users.php +++ b/admin/users.php @@ -174,6 +174,28 @@ switch ($action) { show_confirmation(_('Error'),_('Unable to Disabled last Administrator'),'admin/users.php'); } break; + case 'show_inactive': + $view = new View(); + $view->import_session_view(); + + // If we are returning + if ($_REQUEST['keep_view']) { + $view->initialize(); + } + else { + + $inactive = time() - ($_REQUEST['days'] * 24 * 60 *60); + + $sql = "SELECT `id`,`last_seen` FROM `user` where last_seen <= $inactive"; + $db_results = mysql_query($sql,dbh()); + $total_items = mysql_num_rows($db_results); + $view = new View($sql,'admin/users.php','fullname',$total_items,$_SESSION['userdata']['offset_limit']); + } + + $users = get_users($view->sql); + require_once(conf('prefix') . '/templates/show_users.inc.php'); + + break; default: // Setup the View Object $view = new View(); diff --git a/templates/show_admin_tools.inc.php b/templates/show_admin_tools.inc.php index b68c8631..7dcb2efc 100644 --- a/templates/show_admin_tools.inc.php +++ b/templates/show_admin_tools.inc.php @@ -85,6 +85,7 @@ $catalogs = $catalog->get_catalogs(); <a href="<?php echo $web_path; ?>/admin/system.php?action=generate_config"><?php echo _('Generate New Config'); ?></a> <a href="<?php echo $web_path; ?>/admin/preferences.php?action=show_set_preferences"><?php echo _('Preferences Permissions'); ?></a> <a href="<?php echo $web_path; ?>/admin/system.php?action=export&export=itunes"><?php echo _('Export To Itunes DB'); ?></a> + <a href="<?php echo $web_path; ?>/admin/users.php?action=show_inactive&days=30"><?php echo _('Show Inactive Users'); ?></a> <!-- <a href="<?php echo $web_path; ?>/admin/system.php?action=check_version"><?php echo _('Check for New Version'); ?></a>--> </div> <?php show_box_bottom(); ?> diff --git a/templates/show_users.inc.php b/templates/show_users.inc.php index 39bf90f6..9d2e1b1b 100644 --- a/templates/show_users.inc.php +++ b/templates/show_users.inc.php @@ -24,8 +24,34 @@ $total_items = $view->total_items; $admin_menu = "admin/"; show_box_top(_('Manage Users')); +?> +<table class="tabledata" cellpadding="0" cellspacing="10" border="0"> +<tr> +<td> +<?php echo get_user_icon('add_user') . ' '; echo '<a href="' . $web_path . '/admin/users.php?action=show_add_user">' . _('Add a new user') . '</a>'; + if (isset ($_REQUEST['action']) || $_REQUEST['action'] == "show_inactive"){ + ?> +</td> +</tr> +<form name="show_inactive" enctype="multipart/form-data" method="request" action="<?php echo conf('web_path') . "/admin/users.php"; ?>"> +<tr align="center"> + <td> + Inactive users for <input type=text name="days" size="4" value="<?php if (isset ($_REQUEST['days'])){ echo $_REQUEST['days'];}?>" /> days + </td> +</tr> +<tr> + <td> + <input type="hidden" name="action" value="show_inactive" /> + <input type="Submit" /> + </td> +</tr> +</form> + <?php + }?> +</table> +<?php show_box_bottom(); ?> <?php show_box_top(); ?> |