source: extensions/Comments_on_Albums/trunk/include/coa_admin_intro.php @ 21347

Last change on this file since 21347 was 21347, checked in by mistic100, 11 years ago

update PWG Stuffs module, use UNIX eol

File size: 1.3 KB
Line 
1<?php
2/* adds info about comments count on main admin page, uses javascript */
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5global $template;
6
7// comments count
8$query = '
9SELECT COUNT(*)
10  FROM '.COA_TABLE.'
11;';
12list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
13
14$template->assign(
15  'DB_COMMENTS_ALBUMS', 
16  l10n_dec('%d comment', '%d comments', $nb_comments)
17  );
18
19// unvalidated comments
20$query = '
21SELECT COUNT(*)
22  FROM '.COA_TABLE.'
23  WHERE validated=\'false\'
24;';
25list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
26
27if ($nb_comments > 0) 
28{
29  $template->assign(
30    'unvalidated_albums', 
31    array(
32      'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&amp;section=albums',
33      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
34      )
35    );
36}
37
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}
58
59?>
Note: See TracBrowser for help on using the repository browser.