3 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
4 * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
6 * This file is a part of Codendi.
8 * Codendi is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Codendi is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
22 require_once('Widget.class.php');
25 * Widget_ProjectMembers
27 class Widget_ProjectMembers extends Widget {
28 public function __construct() {
29 $this->Widget('projectmembers');
31 public function getTitle() {
32 return _('Project Members');
34 public function getContent() {
35 $request =& HTTPRequest::instance();
36 $group_id = $request->get('group_id');
37 $pm = ProjectManager::instance();
38 $project = $pm->getProject($group_id);
40 $admins = $project->getAdmins() ;
41 $members = $project->getUsers() ;
45 if (count($admins) > 0) {
46 echo '<span class="develtitle">'._('Project Admins').'</span><br />';
47 foreach ($admins as $u) {
48 echo '<div rel="doap:maintainer">'."\n";
49 // A foaf:Person that holds an account on the forge
50 $developer_url = util_make_url_u ($u->getUnixName(),$u->getID());
51 echo '<div typeof="foaf:Person" about="'.
52 $developer_url.'#me' .'" >'."\n";
53 echo '<div rel="foaf:account">'."\n";
54 echo '<div typeof="sioc:UserAccount" about="'.
57 echo util_display_user($u->getUnixName(),$u->getID(),$u->getRealName())."\n";
58 echo "</div>\n"; // /sioc:UserAccount
59 echo "</div>\n"; // /foaf:holdsAccount
60 echo "</div>\n"; // /foaf:Person
61 echo "</div>\n"; // /doap:maintainer|developer
62 if ($u->getID() == user_getid()) {
65 $seen[] = $u->getID() ;
68 $seen_member = false ;
69 if (count($members) > 0) {
70 foreach ($members as $u) {
71 if (in_array ($u->getID(), $seen)) {
75 echo '<span class="develtitle">'. _('Members').':</span><br />';
78 echo '<div rel="doap:developer">'."\n";
79 // A foaf:Person that holds an account on the forge
80 $developer_url = util_make_url_u ($u->getUnixName(),$u->getID());
81 echo '<div typeof="foaf:Person" about="'.
82 $developer_url.'#me' .'" >'."\n";
83 echo '<div rel="foaf:account">'."\n";
84 echo '<div typeof="sioc:UserAccount" about="'.
87 echo util_display_user($u->getUnixName(),$u->getID(),$u->getRealName())."\n";
88 echo "</div>\n"; // /sioc:UserAccount
89 echo "</div>\n"; // /foaf:holdsAccount
90 echo "</div>\n"; // /foaf:Person
91 echo "</div>\n"; // /doap:maintainer|developer
92 if ($u->getID() == user_getid()) {
98 echo '<p><span rel="sioc:has_usergroup">';
99 echo '<span about="members/" typeof="sioc:UserGroup">';
100 echo '<span rel="http://www.w3.org/2002/07/owl#sameAs">';
101 echo util_make_link ('/project/memberlist.php?group_id='.$group_id,sprintf(_('View the %1$d Member(s)'),count($members)));
105 // end of project usergroup description
108 echo '<p>'.util_make_link ('/project/request.php?group_id='.$group_id,_('Request to join')).'</p>';
111 public function canBeUsedByProject(&$project) {
114 function getDescription() {
115 return _('List the project members.');
121 // c-file-style: "bsd"