source: extensions/rv_autocomplete/admin/exclude.php @ 22214

Revision 22214, 1.3 KB checked in by rvelices, 7 years ago (diff)
Line 
1<?php 
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4$rvac_conf = rvac_get_conf();
5
6if (!empty($_POST))
7{
8  foreach( array('excluded_albums','excluded_tags') as $k)
9  {
10    if (!empty($_POST[$k]))
11    {
12      $rvac_conf[$k] = $_POST[$k];
13      foreach($rvac_conf[$k] as &$v)
14      {
15        $v=intval($v);
16      }
17      unset($v);
18    }
19    else
20      $rvac_conf[$k] = array();
21  }
22  rvac_save_conf($rvac_conf);
23  rvac_invalidate_cache();
24}
25
26$query = 'SELECT id, name, uppercats, global_rank, COUNT(image_id) AS counter
27  FROM '.CATEGORIES_TABLE.' LEFT JOIN '.IMAGE_CATEGORY_TABLE.'
28  ON id = category_id
29  GROUP BY id
30  ORDER BY global_rank';
31$albums = array_from_query($query);
32usort($albums, 'global_rank_compare');
33
34display_select_categories($albums, (array)$rvac_conf['excluded_albums'], 'albums', false );
35
36
37$query = 'SELECT id, name, COUNT(image_id) AS counter
38  FROM '.TAGS_TABLE.' LEFT JOIN '.IMAGE_TAG_TABLE.'
39  ON id = tag_id
40  GROUP BY id
41  ORDER BY url_name';
42$tags = array_from_query($query);
43$tags_select = array();
44foreach($tags as $tag)
45  $tags_select[ $tag['id'] ] = trigger_event('render_tag_name', $tag['name']) . ' '.$tag['counter'];
46
47$template->assign( array(
48  'U_FORM' => $my_base_url,
49  'tags' => $tags_select,
50  'tags_selected' => (array)$rvac_conf['excluded_tags'],
51) );
52?>
Note: See TracBrowser for help on using the repository browser.