Changeset 1891


Ignore:
Timestamp:
Mar 11, 2007, 4:11:53 PM (17 years ago)
Author:
plg
Message:

New: in history search, display tag names instead of tag ids in filtered
lines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/history.php

    r1890 r1891  
    303303    }
    304304
     305    if (isset($row['tag_ids']))
     306    {
     307      foreach (explode(',', $row['tag_ids']) as $tag_id)
     308      {
     309        array_push($tag_ids, $tag_id);
     310      }
     311    }
     312
    305313    array_push(
    306314      $history_lines,
     
    379387
    380388    // echo '<pre>'; print_r($high_filesize_of_image); echo '</pre>';
     389  }
     390
     391  if (count($tag_ids) > 0)
     392  {
     393    $tag_ids = array_unique($tag_ids);
     394
     395    $query = '
     396SELECT
     397    id,
     398    name
     399  FROM '.TAGS_TABLE.'
     400  WHERE id IN ('.implode(', ', $tag_ids).')
     401;';
     402    $name_of_tag = array();
     403
     404    $result = pwg_query($query);
     405    while ($row = mysql_fetch_array($result))
     406    {
     407      $name_of_tag[ $row['id'] ] = $row['name'];
     408    }
    381409  }
    382410 
     
    428456    $user_string.= '&amp;user_id='.$line['user_id'];
    429457    $user_string.= '">+</a>';
     458
     459    $tags_string = '';
     460    if (isset($line['tag_ids']))
     461    {
     462      $tags_string = preg_replace(
     463        '/(\d+)/e',
     464        '$name_of_tag["$1"]',
     465        str_replace(
     466          ',',
     467          ', ',
     468          $line['tag_ids']
     469          )
     470        );
     471    }
    430472   
    431473    $template->assign_block_vars(
     
    456498                : 'deleted '.$line['category_id'] )
    457499          : '',
    458         'TAGS'       => $line['tag_ids'],
     500        'TAGS'       => $tags_string,
    459501        'T_CLASS'   => ($i % 2) ? 'row1' : 'row2',
    460502        )
     
    602644  $selected = '';
    603645
    604   if ($row['id'] == $form['user'])
     646  if (isset($form['user'])
     647      and $row['id'] == $form['user'])
    605648  {
    606649    $selected = 'selected="selected"';
Note: See TracChangeset for help on using the changeset viewer.