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');
32 public function getTitle() {
33 return _('Project Members');
36 public function getContent() {
37 $request =& HTTPRequest::instance();
38 $group_id = $request->get('group_id');
39 $pm = ProjectManager::instance();
40 $project = $pm->getProject($group_id);
42 $admins = $project->getAdmins() ;
43 $members = $project->getUsers() ;
47 if (count($admins) > 0) {
48 echo '<span class="develtitle">'._('Project Admins').'</span><br />';
49 foreach ($admins as $u) {
50 echo '<div rel="doap:maintainer">'."\n";
51 // A foaf:Person that holds an account on the forge
52 $developer_url = util_make_url_u ($u->getUnixName(),$u->getID());
53 echo '<div typeof="foaf:Person" about="'.
54 $developer_url.'#person' .'" >'."\n";
55 echo '<div rel="foaf:account">'."\n";
56 echo '<div typeof="sioc:UserAccount" about="'.
59 echo util_display_user($u->getUnixName(),$u->getID(),$u->getRealName())."\n";
60 echo "</div>\n"; // /sioc:UserAccount
61 echo "</div>\n"; // /foaf:holdsAccount
62 echo "</div>\n"; // /foaf:Person
63 echo "</div>\n"; // /doap:maintainer|developer
64 if ($u->getID() == user_getid()) {
67 $seen[] = $u->getID() ;
70 $seen_member = false ;
71 if (count($members) > 0) {
72 foreach ($members as $u) {
73 if (in_array ($u->getID(), $seen)) {
77 echo '<span class="develtitle">'. _('Members').':</span><br />';
80 echo '<div rel="doap:developer">'."\n";
81 // A foaf:Person that holds an account on the forge
82 $developer_url = util_make_url_u ($u->getUnixName(),$u->getID());
83 echo '<div typeof="foaf:Person" about="'.
84 $developer_url.'#person' .'" >'."\n";
85 echo '<div rel="foaf:account">'."\n";
86 echo '<div typeof="sioc:UserAccount" about="'.
89 echo util_display_user($u->getUnixName(),$u->getID(),$u->getRealName())."\n";
90 echo "</div>\n"; // /sioc:UserAccount
91 echo "</div>\n"; // /foaf:holdsAccount
92 echo "</div>\n"; // /foaf:Person
93 echo "</div>\n"; // /doap:maintainer|developer
94 if ($u->getID() == user_getid()) {
100 echo '<p><span rel="sioc:has_usergroup">';
101 echo '<span about="members/" typeof="sioc:UserGroup">';
102 echo '<span rel="http://www.w3.org/2002/07/owl#sameAs">';
103 echo util_make_link ('/project/memberlist.php?group_id='.$group_id,sprintf(_('View the %1$d Member(s)'),count($members)));
107 // end of project usergroup description
110 echo '<p>'.util_make_link ('/project/request.php?group_id='.$group_id,_('Request to join')).'</p>';
114 public function canBeUsedByProject(&$project) {
118 function getDescription() {
119 return _('List the project members.');
125 // c-file-style: "bsd"