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
This commit is contained in:
parent
091b30247b
commit
b79c8aceae
2 changed files with 75 additions and 4 deletions
|
@ -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']
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 -->
|
||||
|
|
Loading…
Reference in a new issue