Ignore:
Timestamp:
Jun 7, 2011, 9:44:37 PM (13 years ago)
Author:
mistic100
Message:

big code cleaning

File:
1 edited

Legend:

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

    r10984 r11267  
    22/* adds info about comments count on main admin page, uses javascript */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5global $template;
    46
    57// comments count
     
    1012list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    1113
    12 $template->assign('DB_COMMENTS_ALBUMS', l10n_dec('%d comment', '%d comments', $nb_comments));
     14$template->assign(
     15  'DB_COMMENTS_ALBUMS',
     16  l10n_dec('%d comment', '%d comments', $nb_comments)
     17  );
    1318
    1419// unvalidated comments
     
    2025list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    2126
    22 if ($nb_comments > 0) {
    23   $template->assign('unvalidated_albums', array(
    24     'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums',
    25     'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
    26   ));
     27if ($nb_comments > 0)
     28{
     29  $template->assign(
     30    'unvalidated_albums',
     31    array(
     32      'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums',
     33      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
     34      )
     35    );
    2736}
    2837
    29 // template
    30 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_admin_intro.tpl');
    31 $template->concat('ADMIN_CONTENT', $template->parse('comments_on_albums', true));
     38$template->set_prefilter('intro', 'coa_admin_intro_prefilter');
     39
     40function coa_admin_intro_prefilter($content, &$smarty)
     41{
     42  $search = '(<a href="{$unvalidated.URL}">{$unvalidated.INFO}</a>)';
     43       
     44  $replace = $search.'
     45        {/if}
     46        [{\'Photos\'|@translate}]
     47      </li>
     48      <li>
     49        {$DB_COMMENTS_ALBUMS}
     50        {if isset($unvalidated_albums)}
     51        (<a href="{$unvalidated_albums.URL}">{$unvalidated_albums.INFO}</a>)
     52        {/if}
     53        [{\'Albums\'|@translate}]
     54      {if true}';
     55
     56  return str_replace($search, $replace, $content);
     57}
    3258
    3359?>
Note: See TracChangeset for help on using the changeset viewer.