00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: user_home.php 5442 2006-02-19 15:14:12Z yeupou $
00006 #
00007 # Copyright 1999-2000 (c) The SourceForge Crew
00008 # Copyright 2000-2001 (c) Free Software Foundation
00009 #
00010 # Copyright 2003-2006 (c) Mathieu Roy <yeupou--gnu.org>
00011 #
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00025
00026 register_globals_off();
00027 require_directory("my");
00028
00029 # Assumes $res_user result handle is present
00030
00031 if (!$res_user || db_numrows($res_user) < 1)
00032 {
00033 exit_error('No Such User','No Such User');
00034 }
00035
00036 site_header(array('title'=>sprintf(_("%s Profile"),db_result($res_user, $i, 'realname')),
00037 'context'=>'people'));
00038
00039 # For suspended account, we will print only very basic info:
00040 # accound id, login + description as deleted account
00041 $is_suspended = 0;
00042 if (db_result($res_user,0,'status') == 'S')
00043 { $is_suspended = 1; }
00044
00045
00046 print '<p>'.sprintf(_("Follows the Profile of %s."), utils_user_link(db_result($res_user, $i, 'user_name'),db_result($res_user, $i, 'realname'))).'</p>';
00047
00048
00049 print html_splitpage("start");
00050
00051
00052 if (!$is_suspended)
00053 {
00054
00055 # List items:
00056 # - ignore recipes, it is less personal
00057 # - ignore closed items, it would make a page that dont scale for
00058 # very active developers
00059 # - ignore private items
00060
00061
00062 print $HTML->box_top(sprintf(_("Open Items submitted by %s"),db_result($res_user,0,'realname')),'',1);
00063 # FIXME: News item are missing
00064 my_item_list("submitter", "0", "open", $user_id, true);
00065 print $HTML->box_bottom(1);
00066
00067 print "<br />\n";
00068
00069 print $HTML->box_top(sprintf(_("Open Items assigned to %s"),db_result($res_user,0,'realname')),'',1);
00070 # FIXME: News item are missing
00071 my_item_list("assignee", "0", "open", $user_id, true);
00072 print $HTML->box_bottom(1);
00073
00074 }
00075
00076 print html_splitpage(2);
00077
00078
00079
00080 print $HTML->box_top(_("General Information"));
00081
00082 print '
00083 <br />
00084 <table width="100%" cellpadding="0" cellspacing="0" border="0">
00085 <tr valign="top">
00086 <td>'
00087 ._("Real Name:").' </td>
00088 <td><strong>'.db_result($res_user,0,'realname').'</strong></td>
00089 </tr>
00090 <tr valign="top">
00091 <td>'._("Login Name:").' </td>
00092 <td><strong>'.db_result($res_user,0,'user_name').'</strong></td>
00093 </tr>
00094 <tr valign="top">
00095 <td>'
00096 ._("Id:").' </td>
00097 <td><strong>#'.db_result($res_user,0,'user_id').'</strong></td>
00098 </tr>';
00099
00100
00101 print '
00102 <tr valign="top">
00103 <td>'._("Email Address:").' </td>
00104 <td>
00105 <strong><a href="'.$GLOBALS['sys_home'].'sendmessage.php?touser='.db_result($res_user,0,'user_id').'">';
00106
00107 # Do not print email address to anonymous user
00108 if (db_result($res_user,0,'email_hide') == "1")
00109 {
00110 print _("Send him/her a mail");
00111
00112 }
00113 else
00114 {
00115 print utils_email(db_result($res_user,0,'email'));
00116 }
00117
00118 print '</a></strong>
00119 </td>
00120 </tr>
00121 <tr valign="top">
00122 <td>'
00123 ._("Site Member Since").':
00124 </td>
00125 <td>
00126 <strong>'.format_date(false,db_result($res_user,0,'add_date')).'</strong>
00127 </td>
00128 </tr>
00129 <tr valign="top">
00130 <td></td>
00131 <td>';
00132
00133 if (db_result($res_user,0,'people_view_skills') != 1) {
00134 print _("This user deactivated his/her Resume & Skills").'.';
00135 } else {
00136 print '<a href="'.$GLOBALS['sys_home'].'people/resume.php?user_id='.db_result($res_user,0,'user_id').'"><strong>'._("View Resume & Skills").'</strong></a>';
00137 }
00138
00139 print '
00140 </td>
00141 </tr>
00142 ';
00143
00144 if (db_result($res_user,0,'gpg_key') != "") {
00145 print '<tr valign="top"><td></td><td>';
00146 print '<a href="'.$GLOBALS['sys_home'].'people/viewgpg.php?user_id='.db_result($res_user,0,'user_id').'"><strong>'._("Download GPG Key").'</strong></a>';
00147 print '</td></tr>';
00148
00149 }
00150
00151 print '</table>';
00152
00153 print $HTML->box_bottom();
00154
00155
00156 if (!$is_suspended)
00157 {
00158
00159 print "<br />\n";
00160
00161 print $HTML->box_top(_("Project/Group Information"),'',1);
00162 # now get listing of groups for that user
00163
00164 $sql = "SELECT groups.group_name,"
00165 . "groups.group_id,"
00166 . "groups.unix_group_name,"
00167 . "groups.status,"
00168 . "user_group.admin_flags, "
00169 . "group_history.date "
00170 . "FROM groups,user_group,group_history "
00171 . "WHERE groups.group_id=user_group.group_id "
00172 . "AND user_group.user_id='".$user_id."' "
00173 . "AND groups.status='A' "
00174 . "AND groups.is_public='1' "
00175 . "AND (group_history.field_name='Added User' OR group_history.field_name='Approved User' OR user_group.admin_flags='P')"
00176 . "AND group_history.group_id=user_group.group_id "
00177 . "AND group_history.old_value='".db_result($res_user,0,'user_name')."' "
00178 . "GROUP BY groups.unix_group_name "
00179 . "ORDER BY groups.unix_group_name";
00180
00181 $result = db_query($sql);
00182 $rows = db_numrows($result);
00183
00184 # Unlike in mygroups, we dont check if the history is broken or not.
00185 # We assume it is ok.
00186
00187 $j = 1;
00188 unset($content);
00189 for ($i=0; $i<$rows; $i++)
00190 {
00191 $content .= '<li class="'.utils_get_alt_row_color($j).'">';
00192 $content .= '<a href="'.$GLOBALS['sys_home'].'projects/'. db_result($result,$i,'unix_group_name') .'/">'.db_result($result,$i,'group_name').'</a><br />';
00193 $date_joined = db_result($result, $i, 'date');
00194 if ($date_joined)
00195 {
00196 # If the group history is flawed (site install problem), the
00197 # date may be unavailable
00198 $content .= '<span class="smaller">'.
00199 sprintf(_("Member since %s"),
00200 format_date('', $date_joined)).
00201 '</span>';
00202 }
00203 $content .= '</li>';
00204 $exists=1;
00205 $j++;
00206 }
00207
00208 if (!$exists)
00209 {
00210 print _("This user is not a member of any Project/Group");
00211 }
00212 else
00213 {
00214 print '<ul class="boxli">'.$content.'</ul>';
00215 }
00216 unset($exists);
00217
00218 print $HTML->box_bottom(1);
00219
00220
00221 print html_splitpage(3).'<p class="clearr"> </p>';
00222
00223 if (user_isloggedin())
00224 {
00225 sendmail_form_message($GLOBALS['sys_home'].'sendmessage.php', $user_id);
00226
00227 }
00228 else
00229 {
00230 print '<p class="warn">'._("You Could Send a Message if you were logged in").'.</p>';
00231
00232 }
00233
00234 }
00235
00236 $HTML->footer(array());
00237
00238 ?>