Ignore:
Timestamp:
Jun 12, 2011, 12:29:11 AM (13 years ago)
Author:
mistic100
Message:

correct link in notification mail, add album thumbnail on comments list (both public and admin side)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Comments_on_Albums/include/coa_admin_comments.php

    r11267 r11327  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 global $template, $conf;
     5global $template, $conf, $user;
    66load_language('plugin.lang', COA_PATH);
    77
     
    1111include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    1212
    13 $tabs = array(
    14   array(
    15     'code' => 'pictures',
    16     'label' => l10n('COA_comments_photos'),
    17     ),
    18   array(
    19     'code' => 'albums',
    20     'label' => l10n('COA_comments_albums'),
    21     ),
    22   );
    23 
    24 $tab_codes = array_map(create_function('$a', 'return $a["code"];'), $tabs);
    25 
    26 if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes))
     13if (isset($_GET['section']) and $_GET['section'] == 'albums')
    2714{
    28   $page['tab'] = $_GET['section'];
     15  $page['tab'] = 'albums';
    2916}
    3017else
    3118{
    32   $page['tab'] = $tabs[0]['code'];
     19  $page['tab'] = 'pictures';
    3320}
    3421
    3522$tabsheet = new tabsheet();
    36 foreach ($tabs as $tab)
    37 {
    38   $tabsheet->add(
    39     $tab['code'],
    40     $tab['label'],
    41     get_root_url().'admin.php?page=comments&section='.$tab['code']
    42     );
    43 }
     23$tabsheet->add('pictures', l10n('COA_comments_photos'), get_root_url().'admin.php?page=comments');
     24$tabsheet->add('albums', l10n('COA_comments_albums'), get_root_url().'admin.php?page=comments&section=albums');
    4425$tabsheet->select($page['tab']);
    4526$tabsheet->assign();
     
    134115    com.date,
    135116    com.author,
    136     '.$conf['user_fields']['username'].' AS username,
     117    u.'.$conf['user_fields']['username'].' AS username,
    137118    com.content,
    138     cat.name
     119    cat.name,
     120    img.id AS image_id,
     121    img.path,
     122    img.tn_ext
    139123  FROM '.COA_TABLE.' AS com
    140     INNER JOIN '.CATEGORIES_TABLE.' AS cat
     124    LEFT JOIN '.CATEGORIES_TABLE.' AS cat
    141125      ON cat.id = com.category_id
    142126    LEFT JOIN '.USERS_TABLE.' AS u
    143127      ON u.'.$conf['user_fields']['id'].' = com.author_id
     128    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc
     129      ON ucc.cat_id = com.category_id AND ucc.user_id = '.$user['id'].'
     130    LEFT JOIN '.IMAGES_TABLE.' AS img
     131      ON img.id = ucc.user_representative_picture_id
    144132  WHERE validated = \'false\'
    145133  ORDER BY com.date DESC
     
    159147    }
    160148   
     149    // thumbnail
     150    $row['thumb'] = get_thumbnail_url(
     151      array(
     152        'id' => $row['image_id'],
     153        'path' => $row['path'],
     154        'tn_ext' => @$row['tn_ext'],
     155        )
     156     );
     157   
    161158    // comment content
    162159    $template->append(
    163160      'comments',
    164161      array(
     162        'ID' => $row['id'],
    165163        'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$row['category_id'],
    166         'CAT_NAME' => $row['name'],
    167         'ID' => $row['id'],
     164        'CAT_NAME' => trigger_event('render_category_name', $row['name']),
     165        'TN_SRC' => $row['thumb'],
    168166        'AUTHOR' => trigger_event('render_comment_author', $author_name),
    169167        'DATE' => format_date($row['date'], true),
Note: See TracChangeset for help on using the changeset viewer.