Changeset 776
- Timestamp:
- Apr 29, 2005, 12:06:20 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/user_list.php
r768 r776 123 123 'VALUE' => $item, 124 124 'CONTENT' => $label, 125 125 'SELECTED' => $selected 126 126 )); 127 127 } 128 128 129 $blockname = 'group_option'; 130 131 $template->assign_block_vars( 132 $blockname, 133 array( 134 'VALUE'=> -1, 135 'CONTENT' => '------------', 136 'SELECTED' => '' 137 )); 138 139 $query = ' 140 SELECT id, name 141 FROM '.GROUPS_TABLE.' 142 ;'; 143 $result = pwg_query($query); 144 145 while ($row = mysql_fetch_array($result)) 146 { 147 $selected = (isset($_GET['group']) and $_GET['group'] == $row['id']) ? 148 'selected="selected"' : ''; 149 $template->assign_block_vars( 150 $blockname, 151 array( 152 'VALUE' => $row['id'], 153 'CONTENT' => $row['name'], 154 'SELECTED' => $selected 155 )); 156 } 157 129 158 // +-----------------------------------------------------------------------+ 130 159 // | filter | 131 160 // +-----------------------------------------------------------------------+ 132 161 133 $username = !empty($_GET['username']) ? $_GET['username'] : '%'; 134 $username = str_replace('*', '%', $username); 135 if (function_exists('mysql_real_escape_string')) 136 { 137 $username = mysql_real_escape_string($username); 138 } 139 else 140 { 141 $username = mysql_escape_string($username); 142 } 143 $username = !empty($username) ? $username : '%'; 162 $filter = array(); 163 164 if (isset($_GET['username']) and !empty($_GET['username'])) 165 { 166 $username = str_replace('*', '%', $_GET['username']); 167 if (function_exists('mysql_real_escape_string')) 168 { 169 $username = mysql_real_escape_string($username); 170 } 171 else 172 { 173 $username = mysql_escape_string($username); 174 } 175 176 if (!empty($username)) 177 { 178 $filter['username'] = $username; 179 } 180 } 181 182 if (isset($_GET['group']) 183 and -1 != $_GET['group'] 184 and is_numeric($_GET['group'])) 185 { 186 $filter['group'] = $_GET['group']; 187 } 188 144 189 145 190 // +-----------------------------------------------------------------------+ … … 148 193 149 194 $query = ' 150 SELECT count(*) 151 FROM '.USERS_TABLE.' 152 WHERE id != 2 153 AND username LIKE \''.$username.'\' 195 SELECT COUNT(DISTINCT(id)) 196 FROM '.USERS_TABLE.' LEFT JOIN '.USER_GROUP_TABLE.' ON id = user_id 197 WHERE id != 2'; 198 if (isset($filter['username'])) 199 { 200 $query.= ' 201 AND username LIKE \''.$filter['username'].'\''; 202 } 203 if (isset($filter['group'])) 204 { 205 $query.= ' 206 AND group_id = '.$filter['group']; 207 } 208 $query.= ' 154 209 ;'; 155 210 list($counter) = mysql_fetch_row(pwg_query($query)); … … 192 247 $query = ' 193 248 SELECT id, username, mail_address, status 194 FROM '.USERS_TABLE.' 195 WHERE id != 2 196 AND username LIKE \''.$username.'\' 249 FROM '.USERS_TABLE.' LEFT JOIN '.USER_GROUP_TABLE.' ON id = user_id 250 WHERE id != 2'; 251 if (isset($filter['username'])) 252 { 253 $query.= ' 254 AND username LIKE \''.$filter['username'].'\''; 255 } 256 if (isset($filter['group'])) 257 { 258 $query.= ' 259 AND group_id = '.$filter['group']; 260 } 261 $query.= ' 197 262 ORDER BY '.$order_by.' '.$direction.' 198 263 LIMIT '.$start.', '.$conf['users_page'].' -
trunk/doc/ChangeLog
r770 r776 1 2005-04-28 Pierrick LE GALL 2 3 * user list updated : ability to filter list on group 4 1 5 2005-04-25 Pierrick LE GALL 2 6 -
trunk/template/default/admin/user_list.tpl
r768 r776 22 22 23 23 username <input type="text" name="username" value="{F_USERNAME}" /> 24 25 group 26 <select name="group"> 27 <!-- BEGIN group_option --> 28 <option value="{group_option.VALUE}" {group_option.SELECTED} > {group_option.CONTENT}</option> 29 <!-- END group_option --> 30 </select> 24 31 25 32 {L_ORDER_BY}
Note: See TracChangeset
for help on using the changeset viewer.