source: trunk/admin/user_list.php @ 25194

Last change on this file since 25194 was 25194, checked in by plg, 10 years ago

feature 1668, in progress: redesign user manager (jQuery datatables, AJAX calls)

  • Property svn:eol-style set to LF
File size: 4.3 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2013 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24/**
25 * Add users and manage users list
26 */
27
28// +-----------------------------------------------------------------------+
29// |                              groups list                              |
30// +-----------------------------------------------------------------------+
31
32$groups = array();
33
34$query = '
35SELECT id, name
36  FROM '.GROUPS_TABLE.'
37  ORDER BY name ASC
38;';
39$result = pwg_query($query);
40
41while ($row = pwg_db_fetch_assoc($result))
42{
43  $groups[$row['id']] = $row['name'];
44}
45
46// +-----------------------------------------------------------------------+
47// | template                                                              |
48// +-----------------------------------------------------------------------+
49
50$template->set_filenames(array('user_list'=>'user_list.tpl'));
51
52$query = '
53SELECT
54    DISTINCT u.'.$conf['user_fields']['id'].' AS id,
55    u.'.$conf['user_fields']['username'].' AS username,
56    u.'.$conf['user_fields']['email'].' AS email,
57    ui.status,
58    ui.enabled_high,
59    ui.level
60  FROM '.USERS_TABLE.' AS u
61    INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.'.$conf['user_fields']['id'].' = ui.user_id
62  WHERE u.'.$conf['user_fields']['id'].' > 0
63;';
64
65$result = pwg_query($query);
66while ($row = pwg_db_fetch_assoc($result))
67{
68  $users[] = $row;
69  $user_ids[] = $row['id'];
70}
71
72$template->assign(
73  array(
74    'users' => $users,
75    'all_users' => join(',', $user_ids),
76    )
77  );
78
79// echo '<pre>'; print_r($users); echo '</pre>';
80
81$default_user = get_default_user_info(true);
82
83$template->assign(
84  array(
85    'NB_IMAGE_PAGE' => $default_user['nb_image_page'],
86    'RECENT_PERIOD' => $default_user['recent_period'],
87    'theme_options' => get_pwg_themes(),
88    'theme_selected' => get_default_theme(),
89    'language_options' => get_languages(),
90    'language_selected' => get_default_language(),
91    'association_options' => $groups,
92    )
93  );
94
95// Status options
96foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
97{
98  // Only status <= can be assign
99  if (is_autorize_status(get_access_type_status($status)))
100  {
101    $pref_status_options[$status] = l10n('user_status_'.$status);
102  }
103}
104$template->assign('pref_status_options', $pref_status_options);
105$template->assign('pref_status_selected', 'normal');
106
107// user level options
108foreach ($conf['available_permission_levels'] as $level)
109{
110  $level_options[$level] = l10n(sprintf('Level %d', $level));
111}
112$template->assign('level_options', $level_options);
113$template->assign('level_selected', $default_user['level']);
114
115
116// +-----------------------------------------------------------------------+
117// | html code display                                                     |
118// +-----------------------------------------------------------------------+
119
120$template->assign_var_from_handle('ADMIN_CONTENT', 'user_list');
121?>
Note: See TracBrowser for help on using the repository browser.