Ignore:
Timestamp:
Mar 11, 2007, 6:40:59 PM (17 years ago)
Author:
plg
Message:

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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/history.php

    r1892 r1893  
    466466  $last_line = $page['start'] + $conf['nb_logs_page'];
    467467
    468   $total_filesize = 0;
     468  $summary['total_filesize'] = 0;
     469  $summary['guests_IP'] = array();
    469470
    470471  foreach ($history_lines as $line)
    471472  {
     473    // FIXME when we watch the representative of a non image element, it is
     474    // the not the representative filesize that is counted (as it is
     475    // unknown) but the non image element filesize. Proposed solution: add
     476    // #images.representative_filesize and add 'representative' in the
     477    // choices of #history.image_type.
     478   
    472479    if (isset($line['image_type']))
    473480    {
     
    476483        if (isset($high_filesize_of_image[$line['image_id']]))
    477484        {
    478           $total_filesize+= $high_filesize_of_image[$line['image_id']];
     485          $summary['total_filesize']+=
     486            $high_filesize_of_image[$line['image_id']];
    479487        }
    480488      }
     
    483491        if (isset($filesize_of_image[$line['image_id']]))
    484492        {
    485           $total_filesize+= $filesize_of_image[$line['image_id']];
     493          $summary['total_filesize']+=
     494            $filesize_of_image[$line['image_id']];
    486495        }
    487496      }
     497    }
     498
     499    if ($line['user_id'] == $conf['guest_id'])
     500    {
     501      if (!isset($summary['guests_IP'][ $line['IP'] ]))
     502      {
     503        $summary['guests_IP'][ $line['IP'] ] = 0;
     504      }
     505     
     506      $summary['guests_IP'][ $line['IP'] ]++;
    488507    }
    489508   
     
    557576  }
    558577
     578  $summary['nb_guests'] = 0;
     579  if (count(array_keys($summary['guests_IP'])) > 0)
     580  {
     581    $summary['nb_guests'] = count(array_keys($summary['guests_IP']));
     582
     583    // we delete the "guest" from the $username_of hash so that it is
     584    // avoided in next steps
     585    unset($username_of[ $conf['guest_id'] ]);
     586  }
     587 
     588  $summary['nb_members'] = count($username_of);
     589
     590  $member_strings = array();
     591  foreach ($username_of as $user_id => $user_name)
     592  {
     593    $member_string = $user_name.'&nbsp;<a href="';
     594    $member_string.= PHPWG_ROOT_PATH.'admin.php?page=history';
     595    $member_string.= '&amp;search_id='.$page['search_id'];
     596    $member_string.= '&amp;user_id='.$user_id;
     597    $member_string.= '">+</a>';
     598
     599    $member_strings[] = $member_string;
     600  }
     601 
    559602  $template->assign_block_vars(
    560603    'summary',
    561604    array(
    562       'FILESIZE' => $total_filesize.' KB',
     605      'NB_LINES' => sprintf(
     606        l10n('%d lines filtered'),
     607        $page['nb_lines']
     608        ),
     609      'FILESIZE' => $summary['total_filesize'].' KB',
     610      'USERS' => sprintf(
     611        l10n('%d users'),
     612        $summary['nb_members'] + $summary['nb_guests']
     613        ),
     614      'MEMBERS' => sprintf(
     615        l10n('%d members: %s'),
     616        $summary['nb_members'],
     617        implode(
     618          ', ',
     619          $member_strings
     620          )
     621        ),
     622      'GUESTS' => sprintf(
     623        l10n('%d guests'),
     624        $summary['nb_guests']
     625        ),
    563626      )
    564627    );
Note: See TracChangeset for help on using the changeset viewer.