1 | <?php |
---|
2 | |
---|
3 | load_language('plugin.lang', SPBA_PATH); |
---|
4 | |
---|
5 | global $page, $conf, $user, $template; |
---|
6 | $page['section'] = 'See_photos_by_author'; |
---|
7 | |
---|
8 | //read auteur list |
---|
9 | $groups = array(); |
---|
10 | $query = ' |
---|
11 | select id,username |
---|
12 | FROM ' . USERS_TABLE . ' |
---|
13 | WHERE id<>2 |
---|
14 | ORDER BY username ASC;'; |
---|
15 | $result = pwg_query($query); |
---|
16 | |
---|
17 | while ($row = pwg_db_fetch_assoc($result)) |
---|
18 | { |
---|
19 | $groups[$row['id']] = $row['username']; |
---|
20 | } |
---|
21 | $selected = 0; |
---|
22 | $options[] = l10n('select user'); |
---|
23 | $options['a'] = '----------------------'; |
---|
24 | |
---|
25 | foreach ($groups as $metalist => $metalist2) |
---|
26 | { |
---|
27 | $options[$metalist] = $metalist2; |
---|
28 | } |
---|
29 | $template->assign( |
---|
30 | 'gestionA', |
---|
31 | array( |
---|
32 | 'OPTIONS' => $options, |
---|
33 | 'SELECTED' => $selected |
---|
34 | )); |
---|
35 | |
---|
36 | if (isset($_POST['submitchoixauteur'])) |
---|
37 | { |
---|
38 | $forbidden = get_sql_condition_FandF( |
---|
39 | array( 'visible_images' => 'id' ), |
---|
40 | 'AND' |
---|
41 | ); |
---|
42 | |
---|
43 | $page['section'] = 'See_photos_by_author'; |
---|
44 | |
---|
45 | $query = ' |
---|
46 | SELECT DISTINCT(id) |
---|
47 | FROM '.IMAGES_TABLE.' |
---|
48 | INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id |
---|
49 | WHERE added_by = \''.$_POST['metalist'].'\' |
---|
50 | '.$forbidden.' |
---|
51 | '.$conf['order_by'].' |
---|
52 | ;'; |
---|
53 | |
---|
54 | $page = array_merge( |
---|
55 | $page, |
---|
56 | array( |
---|
57 | 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'.l10n('See photos by author').'</a>', |
---|
58 | 'items' => array_from_query($query, 'id'), |
---|
59 | ) |
---|
60 | ); |
---|
61 | |
---|
62 | //read auteur list |
---|
63 | $groups = array(); |
---|
64 | $query = ' |
---|
65 | select id,username |
---|
66 | FROM ' . USERS_TABLE . ' |
---|
67 | WHERE id<>2 |
---|
68 | ORDER BY username ASC;'; |
---|
69 | $result = pwg_query($query); |
---|
70 | |
---|
71 | while ($row = pwg_db_fetch_assoc($result)) |
---|
72 | { |
---|
73 | $groups[$row['id']] = $row['username']; |
---|
74 | } |
---|
75 | $selected = $_POST['metalist']; |
---|
76 | |
---|
77 | foreach ($groups as $metalist => $metalist2) |
---|
78 | { |
---|
79 | $options[$metalist] = $metalist2; |
---|
80 | } |
---|
81 | $template->assign( |
---|
82 | 'gestionA', |
---|
83 | array( |
---|
84 | 'OPTIONS' => $options, |
---|
85 | 'SELECTED' => $selected |
---|
86 | )); |
---|
87 | } |
---|
88 | $template->assign('SPBA2', 'toto'); |
---|
89 | $template->set_filename('SPBA', realpath(SPBA_PATH.'pagespba.tpl')); |
---|
90 | $template->assign_var_from_handle('CONTENT', 'SPBA'); |
---|
91 | |
---|
92 | ?> |
---|