5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2010, FusionForge Team
7 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
8 * Copyright 2012, Franck Villaume - TrivialDev
10 * Thorsten Glaser <t.glaser@tarent.de>
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge 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 along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 * Assumes $user object for displayed user is present
32 require_once $gfcommon.'include/user_profile.php';
33 require_once $gfwww.'include/vote_function.php';
35 $title = _('User Profile');
36 $HTML->header(array('title'=>$title));
38 echo $HTML->boxTop(_('Personal Information'), _('Personal Information'));
39 echo html_ao('div', array('about' => '', 'typeof' => 'sioc:UserAccount'));
40 echo user_personal_information($user);
42 if (forge_get_config('use_ratings')) {
43 echo $HTML->boxMiddle(_('Peer Rating'), _('Peer Rating'));
44 echo '<table class="my-layout-table" id="user-profile-rating">';
45 if ($user->usesRatings()) {
46 vote_show_user_rating($user_id);
48 echo '<tr><td colspan="2">';
49 echo _('User chose not to participate in peer rating');
52 echo '</table><!-- id="user-profile-rating" -->';
55 if (forge_get_config('use_diary')) {
56 echo $HTML->boxMiddle(_('Diary and Notes'), _('Diary and Notes'));
59 Get their diary information
62 $res = db_query_params('SELECT count(*) from user_diary WHERE user_id=$1 AND is_public=1',
64 echo _('Diary/Note entries:').' '.db_result($res, 0, 0).'
66 //.'<span rel="foaf:weblog">'
67 echo util_make_link('/developer/diary.php?diary_user='.$user_id,htmlentities(_('View Diary and Notes')));
71 echo util_make_link('/developer/monitor.php?diary_user='.$user_id,
72 html_image("ic/check.png",'15','13',array(),0) ._('Monitor this Diary')
75 $hookparams['user_id'] = $user_id;
76 plugin_hook("user_personal_links", $hookparams);
82 echo $HTML->boxMiddle(_('Project Information'), _('Project Information'));
84 $projects = $user->getGroups();
85 sortProjectList ($projects) ;
86 $roles = RBACEngine::getInstance()->getAvailableRolesForUser ($user) ;
87 sortRoleList ($roles) ;
89 // see if there were any groups
91 if (count ($projects) < 1) {
93 <p><?php echo _('This user is not a member of any project.') ?></p>
95 } else { // endif no groups
96 print "<p>"._('This user is a member of the following projects:')."</p>\n";
98 foreach ($projects as $p) {
99 if (!forge_check_perm('project_read', $p->getID())) {
103 $project_link = util_make_link_g ($p->getUnixName(),$p->getID(),$p->getPublicName());
104 $project_uri = util_make_url_g ($p->getUnixName(),$p->getID());
105 // sioc:UserGroups for all members of a project are named after /projects/A_PROJECT/members/
106 $usergroup_uri = $project_uri .'members/';
108 print '<div rel="sioc:member_of">'."\n"
109 .'<div about="'. $usergroup_uri .'" typeof="sioc:UserGroup">'."\n"
110 .'<div rel="sioc:usergroup_of">'."\n"
111 .'<div about="'. $project_uri .'" typeof="sioc:Space">';
112 $role_names = array () ;
113 $sioc_has_function_close = "";
114 foreach ($roles as $r) {
115 if ($r instanceof RoleExplicit
116 && $r->getHomeProject() != NULL
117 && $r->getHomeProject()->getID() == $p->getID()) {
118 $role_names[] = $r->getName() ;
119 print '<div property="sioc:has_function" content= "'.$r->getName().'">';
120 $sioc_has_function_close .= "</div>";
124 print ('<br />' . $project_link .' ('.htmlspecialchars (implode (', ', $role_names)).')');
127 if (forge_check_perm_for_user ($user, 'project_admin', $p->getID())) {
128 print '<span rev="doap:maintainer" resource="#me"></span>';
131 print '<span rev="doap:developer" resource="#me"></span>';
134 echo $sioc_has_function_close."\n"; // sioc:has_function
135 echo "</div>\n"; // sioc:Space .../projects/A_PROJECT/
136 echo "</div>\n"; // sioc:usergroup_of
137 echo "</div>\n"; // sioc:UserGroup .../projects/A_PROJECT/members
138 echo "</div>\n"; // sioc:member_of
141 echo "</div>\n"; // prefixes
143 echo html_ac(html_ap() -1);
145 $me = session_get_user();
146 if (forge_get_config('use_ratings')) {
147 if ($user->usesRatings() && (!$me || $me->usesRatings())) {
150 print _('If you are familiar with this user, please take a moment to rate him/her on the following criteria. Keep in mind, that your rating will be visible to the user and others.');
154 printf(_('The %s Peer Rating system is based on concepts from <a href="http://www.advogato.com/">Advogato.</a> The system has been re-implemented and expanded in a few ways.'), forge_get_config ('forge_name'));
158 <div class="align-center">
159 <?php vote_show_user_rate_box ($user_id, $me?$me->getID():0); ?>
164 print _('The Peer rating box shows all rating averages (and response levels) for each individual criteria. Due to the math and processing required to do otherwise, these numbers incorporate responses from both “trusted” and “non-trusted” users.');
169 printf(_('The “Sitewide Rank” field shows the user\'s rank compared to all ranked %s users.'), forge_get_config('forge_name'));
173 print _('The “Aggregate Score” shows an average, weighted overall score, based on trusted-responses only.');
177 print _('The “Personal Importance” field shows the weight that users ratings of other developers will be given (between 1 and 1.5) -- higher rated user\'s responses are given more weight.');
183 print _('If you would like to opt-out from peer rating system (this will affect your ability to both rate and be rated), refer to <a href="/account/">your account maintenance page</a>. If you choose not to participate, your ratings of other users will be permanently deleted and the “Peer Rating” box will disappear from your user page.');
187 } elseif ($me && !$me->usesRatings()) {
190 printf (_('You opted-out from peer rating system, otherwise you would have a chance to rate the user. Refer to <a href="%s">your account maintenance page</a> for more information.'),
191 util_make_url ("/account"));
196 echo $HTML->boxBottom();
202 // c-file-style: "bsd"