5 * Copyright 2004 (c) Tim Perdue - GForge LLC
6 * Copyright 2010 (c) Franck Villaume - Capgemini
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once('../../env.inc.php');
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfwww.'project/admin/project_admin_utils.php';
28 require_once $gfwww.'include/role_utils.php';
30 $group_id = getIntFromRequest('group_id');
31 session_require_perm ('project_admin', $group_id) ;
33 $group = group_get_object($group_id);
34 if (!$group || !is_object($group)) {
36 } elseif ($group->isError()) {
37 exit_error($group->getErrorMessage(),'admin');
40 $sw = getStringFromRequest('sw', 'A');
42 $res = db_query_params('SELECT user_id,user_name,lastname,firstname FROM users WHERE status=$1 and type_id=1 and lower(lastname) LIKE $2 ORDER BY lastname,firstname ASC',
44 strtolower ($sw."%")));
46 $accumulated_ids = getStringFromRequest('accumulated_ids');
47 if (!$accumulated_ids) {
48 $accumulated_ids=array();
50 $accumulated_ids =& explode(',',$accumulated_ids);
53 $newids = getArrayFromRequest('newids');
54 if (count($newids) > 0) {
55 if (count($accumulated_ids) > 0) {
56 $accumulated_ids = array_merge($accumulated_ids,$newids);
58 $accumulated_ids=$newids;
61 $accumulated_ids = array_unique($accumulated_ids);
63 if (getStringFromRequest('finished')) {
64 session_redirect('/project/admin/massfinish.php?group_id='.$group_id.'&accumulated_ids='.implode(',',$accumulated_ids));
67 project_admin_header(array('title'=>_('Add Users From List'),'group'=>$group_id));
71 '._('Check the box next to the name of the user(s) you want to add. Your choices will be preserved if you click any of the letters below. When done, click "Finish" to choose the roles for the users you are adding.').'
73 <form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'" method="post">
74 <input type="hidden" name="accumulated_ids" value="'. implode(',',$accumulated_ids) .'" />';
76 $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
77 echo '<p>' . _('Choose the <strong>First Letter</strong> of the name of the person you wish to add.') . '</p>';
78 for ($i=0; $i<count($abc_array); $i++) {
79 if ($sw == $abc_array[$i]) {
80 echo '<strong>'.$abc_array[$i].'</strong> ';
82 echo '<input type="submit" name="sw" value="'.$abc_array[$i].'" /> ';
86 if (!$res || db_numrows($res) < 1) {
87 echo '<p>' . _('No Matching Users Found') . '</p>';
90 $titles[]=_('Real name');
91 $titles[]=_('Unix name');
92 $titles[]=_('Add user');
94 echo $HTML->listTableTop($titles);
97 // Everything is built on the multi-dimensial arrays in the Role object
99 for ($i=0; $i<db_numrows($res); $i++) {
100 $uid = db_result($res,$i,'user_id');
101 echo '<tr '. $HTML->boxGetAltRowStyle($i) . '>
102 <td>'.db_result($res,$i,'lastname').', '.db_result($res,$i,'firstname').'</td>
103 <td>'.db_result($res,$i,'user_name').'</td>
104 <td><input type="checkbox" name="newids[]" value="'. $uid .'"';
105 if (in_array($uid, $accumulated_ids)) {
106 echo ' checked="checked" ';
108 echo ' /></td></tr>';
112 echo $HTML->listTableBottom();
116 echo '<p><input type="submit" name="finished" value="'._('Finish').'" /></p>
119 project_admin_footer(array());
123 // c-file-style: "bsd"