diff options
author | plegall <plg@piwigo.org> | 2007-03-11 17:40:59 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2007-03-11 17:40:59 +0000 |
commit | b79c8aceae62df26ab17049c9ce9330fdac3ab35 (patch) | |
tree | fd0145b38a01b3ffae225d3c749ee466d98efcaa | |
parent | 091b30247b63966eb7ce77986f10ca40c461fd7d (diff) |
New: history search results summary gives the number of filtered lines and
give details about number of total users with the number of guests and the
member names (that can be added to filter criteria).
git-svn-id: http://piwigo.org/svn/trunk@1893 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/history.php | 71 | ||||
-rw-r--r-- | template/yoga/admin/history.tpl | 8 |
2 files changed, 75 insertions, 4 deletions
diff --git a/admin/history.php b/admin/history.php index b82fc58cc..d749a25b1 100644 --- a/admin/history.php +++ b/admin/history.php @@ -465,27 +465,46 @@ SELECT $first_line = $page['start'] + 1; $last_line = $page['start'] + $conf['nb_logs_page']; - $total_filesize = 0; + $summary['total_filesize'] = 0; + $summary['guests_IP'] = array(); foreach ($history_lines as $line) { + // FIXME when we watch the representative of a non image element, it is + // the not the representative filesize that is counted (as it is + // unknown) but the non image element filesize. Proposed solution: add + // #images.representative_filesize and add 'representative' in the + // choices of #history.image_type. + if (isset($line['image_type'])) { if ($line['image_type'] == 'high') { if (isset($high_filesize_of_image[$line['image_id']])) { - $total_filesize+= $high_filesize_of_image[$line['image_id']]; + $summary['total_filesize']+= + $high_filesize_of_image[$line['image_id']]; } } else { if (isset($filesize_of_image[$line['image_id']])) { - $total_filesize+= $filesize_of_image[$line['image_id']]; + $summary['total_filesize']+= + $filesize_of_image[$line['image_id']]; } } } + + if ($line['user_id'] == $conf['guest_id']) + { + if (!isset($summary['guests_IP'][ $line['IP'] ])) + { + $summary['guests_IP'][ $line['IP'] ] = 0; + } + + $summary['guests_IP'][ $line['IP'] ]++; + } $i++; @@ -556,10 +575,54 @@ SELECT ); } + $summary['nb_guests'] = 0; + if (count(array_keys($summary['guests_IP'])) > 0) + { + $summary['nb_guests'] = count(array_keys($summary['guests_IP'])); + + // we delete the "guest" from the $username_of hash so that it is + // avoided in next steps + unset($username_of[ $conf['guest_id'] ]); + } + + $summary['nb_members'] = count($username_of); + + $member_strings = array(); + foreach ($username_of as $user_id => $user_name) + { + $member_string = $user_name.' <a href="'; + $member_string.= PHPWG_ROOT_PATH.'admin.php?page=history'; + $member_string.= '&search_id='.$page['search_id']; + $member_string.= '&user_id='.$user_id; + $member_string.= '">+</a>'; + + $member_strings[] = $member_string; + } + $template->assign_block_vars( 'summary', array( - 'FILESIZE' => $total_filesize.' KB', + 'NB_LINES' => sprintf( + l10n('%d lines filtered'), + $page['nb_lines'] + ), + 'FILESIZE' => $summary['total_filesize'].' KB', + 'USERS' => sprintf( + l10n('%d users'), + $summary['nb_members'] + $summary['nb_guests'] + ), + 'MEMBERS' => sprintf( + l10n('%d members: %s'), + $summary['nb_members'], + implode( + ', ', + $member_strings + ) + ), + 'GUESTS' => sprintf( + l10n('%d guests'), + $summary['nb_guests'] + ), ) ); } diff --git a/template/yoga/admin/history.tpl b/template/yoga/admin/history.tpl index 5cc82eeff..87058681f 100644 --- a/template/yoga/admin/history.tpl +++ b/template/yoga/admin/history.tpl @@ -91,7 +91,15 @@ <legend>{lang:Summary}</legend> <ul> + <li>{summary.NB_LINES}</li> <li>{summary.FILESIZE}</li> + <li> + {summary.USERS} + <ul> + <li>{summary.MEMBERS}</li> + <li>{summary.GUESTS}</li> + </ul> + </li> </ul> </fieldset> <!-- END summary --> |