5 * Copyright 2004 (c) GForge LLC
8 * @author Tim Perdue tim@gforge.org
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../../env.inc.php');
29 require_once('pre.php');
30 require_once('www/project/admin/project_admin_utils.php');
31 require_once('www/include/role_utils.php');
33 $group_id = getIntFromRequest('group_id');
34 session_require(array('group'=>$group_id,'admin_flags'=>'A'));
36 $group =& group_get_object($group_id);
37 if (!$group || !is_object($group)) {
38 exit_error('Error','Could Not Get Group');
39 } elseif ($group->isError()) {
40 exit_error('Error',$group->getErrorMessage());
43 $sw = getStringFromRequest('sw');
48 $res=db_query("SELECT user_id,user_name,lastname,firstname FROM users
49 WHERE status='A' and type_id='1' and lastname ILIKE '$sw%' ORDER BY lastname,firstname ASC");
51 $accumulated_ids = getStringFromRequest('accumulated_ids');
52 if (!$accumulated_ids) {
53 $accumulated_ids=array();
55 $accumulated_ids =& explode(',',$accumulated_ids);
58 $newids = getArrayFromRequest('newids');
59 if (count($newids) > 0) {
60 if (count($accumulated_ids) > 0) {
61 $accumulated_ids = array_merge($accumulated_ids,$newids);
63 $accumulated_ids=$newids;
66 $accumulated_ids = array_unique($accumulated_ids);
68 if (getStringFromRequest('finished')) {
69 header("Location: massfinish.php?group_id=$group_id&accumulated_ids=".implode(',',$accumulated_ids));
72 project_admin_header(array('title'=>_('Edit Role'),'group'=>$group_id));
76 <h2>'._('Add Users From List').'</h2>
78 '._('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.').'
80 <form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'" method="post">
81 <input type="hidden" name="accumulated_ids" value="'. implode(',',$accumulated_ids) .'">';
83 $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');
84 echo _('<p>Choose the <strong>First Letter</strong> of the name of the person you wish to add.</p>');
85 for ($i=0; $i<count($abc_array); $i++) {
86 if ($sw == $abc_array[$i]) {
87 echo '<strong>'.$abc_array[$i].'</strong> ';
89 echo '<input type="submit" name="sw" value="'.$abc_array[$i].'"> ';
93 if (!$res || db_numrows($res) < 1) {
94 echo _('<p>No Matching Users Found</p>');
97 $titles[]=_('Real Name');
98 $titles[]=_('Unix Name');
99 $titles[]=_('Add User');
101 echo $HTML->listTableTop($titles);
104 // Everything is built on the multi-dimensial arrays in the Role object
106 for ($i=0; $i<db_numrows($res); $i++) {
107 $uid = db_result($res,$i,'user_id');
108 echo '<tr '. $HTML->boxGetAltRowStyle($i) . '>
109 <td>'.db_result($res,$i,'lastname').', '.db_result($res,$i,'firstname').'</td>
110 <td>'.db_result($res,$i,'user_name').'</td>
111 <td><input type="checkbox" name="newids[]" value="'. $uid .'"';
112 if (in_array($uid, $accumulated_ids)) {
113 echo ' checked="checked"';
119 echo $HTML->listTableBottom();
123 echo '<input type="submit" name="finished" value="'._('Finish').'">
126 project_admin_footer(array());