3 * GForge User's Personal Page
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright 2002-2004 (c) GForge Team
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('pre.php');
29 require_once('vote_function.php');
30 require_once('common/tracker/ArtifactsForUser.class');
31 require_once('common/forum/ForumsForUser.class');
32 require_once('common/pm/ProjectTasksForUser.class');
34 if (!session_loggedin()) { // || $sf_user_hash) {
42 //needs security audit
43 * If user has valid "remember-me" hash, instantiate not-logged in
46 if (!session_loggedin()) {
47 list($user_id,$hash)=explode('_',$sf_user_hash);
50 WHERE user_id='".$user_id."' AND user_pw LIKE '".$hash."%'";
52 $result=db_query($sql);
53 $rows=db_numrows($result);
54 if (!$result || $rows != 1) {
57 $user_id=db_result($result,0,'user_id');
58 session_get_user()=user_get_object($user_id,$result);
61 echo site_user_header(array('title'=>$Language->getText('my','title',user_getname())));
65 <?php echo $Language->getText('my', 'about_blurb'); ?>
67 <table width="100%" border="0">
68 <tr><td valign="top" width="50%">
74 echo $HTML->boxTop($Language->getText('my', 'assigneditems'));
75 $artifactsForUser = new ArtifactsForUser(session_get_user());
76 $assignedArtifacts =& $artifactsForUser->getAssignedArtifactsByGroup();
77 if (count($assignedArtifacts) > 0) {
78 foreach($assignedArtifacts as $art) {
80 if ($art->ArtifactType->getID() != $last_group) {
82 <tr><td colspan="2"><strong><a href="/tracker/?group_id='.
83 $art->ArtifactType->Group->getID().'&atid='.
84 $art->ArtifactType->getID().'">'.
85 $art->ArtifactType->Group->getPublicName().' - '.
86 $art->ArtifactType->getName().'</a></strong></td></tr>';
90 <tr style="background-color:'.html_get_priority_color($art->getPriority()).'">
91 <td width="10%">'.$art->getID().'</td>
92 <td><a href="/tracker/?func=detail&aid='.
94 '&group_id='.$art->ArtifactType->Group->getID().
95 '&atid='.$art->ArtifactType->getID().'">' . $art->getSummary() . '</a>';
97 $last_group = $art->ArtifactType->getID();
101 <strong>'.$Language->getText('my', 'no_tracker_items_assigned').'</strong>';
105 echo $HTML->boxMiddle($Language->getText('my', 'submitteditems'),false,false);
106 $submittedArtifacts =& $artifactsForUser->getSubmittedArtifactsByGroup();
107 if (count($submittedArtifacts) > 0) {
108 foreach ($submittedArtifacts as $art) {
110 if ($art->ArtifactType->getID() != $last_group) {
112 <tr><td colspan="2"><strong><a href="/tracker/?group_id='.
113 $art->ArtifactType->Group->getID().'&atid='.
114 $art->ArtifactType->getID().'">'.
115 $art->ArtifactType->Group->getPublicName().' - '.
116 $art->ArtifactType->getName().'</a></strong></td></tr>';
119 <tr style="background-color:'.html_get_priority_color($art->getPriority()).'">
120 <td width="10%">'.$art->getID().'</td>
121 <td><a href="/tracker/?func=detail&aid='.
123 '&group_id='.$art->ArtifactType->Group->getID().
124 '&atid='.$art->ArtifactType->getID().'">' . $art->getSummary() .'</a>';
126 $last_group = $art->ArtifactType->getID();
130 <strong>'.$Language->getText('my', 'no_tracker_items_submitted').'</strong>';
134 Forums that are actively monitored
137 echo $HTML->boxMiddle($Language->getText('my', 'monitoredforum'),false,false);
138 $forumsForUser = new ForumsForUser(session_get_user());
139 $forums =& $forumsForUser->getMonitoredForums();
140 if (count($forums) < 1) {
141 echo '<strong>'.$Language->getText('my', 'no_monitored_forums').'</strong>'.$Language->getText('my', 'no_monitored_forums_details');
143 foreach ($forums as $f) {
145 $group = $f->getGroup();
146 if ($group->getID() != $last_group) {
148 <tr '. $HTML->boxGetAltRowStyle($i) .'><td colspan="2"><strong><a href="/forum/?group_id='.
149 $group->getID().'">'.
150 $group->getPublicName().'</a></strong></td></tr';
154 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center"><a href="/forum/monitor.php?forum_id='.$f->getID().
155 '&stop=1&group_id='.$group->getID().'"><img src="'. $HTML->imgroot . '/ic/trash.png" height="16" width="16" '.
156 'border="0" alt="" /></a></td><td width="99%"><a href="/forum/forum.php?forum_id='.
158 $f->getName().'</a>';
160 $last_group= $group->getID();
165 Filemodules that are actively monitored
169 echo $HTML->boxMiddle($Language->getText('my', 'monitoredfile'),false,false);
171 $sql="SELECT groups.group_name,groups.group_id,frs_package.name,filemodule_monitor.filemodule_id ".
172 "FROM groups,filemodule_monitor,frs_package ".
173 "WHERE groups.group_id=frs_package.group_id AND groups.status = 'A' ".
174 "AND frs_package.package_id=filemodule_monitor.filemodule_id ".
175 "AND filemodule_monitor.user_id='".user_getid()."' ORDER BY group_name DESC";
176 $result=db_query($sql);
177 $rows=db_numrows($result);
178 if (!$result || $rows < 1) {
179 echo '<strong>'.$Language->getText('my', 'no_monitored_filemodules').'</strong>'.$Language->getText('my', 'no_monitored_filemodules_details');
181 for ($i=0; $i<$rows; $i++) {
183 if (db_result($result,$i,'group_id') != $last_group) {
185 <tr '. $HTML->boxGetAltRowStyle($i) .'><td colspan="2"><strong><a href="/project/?group_id='.
186 db_result($result,$i,'group_id').'">'.
187 db_result($result,$i,'group_name').'</a></td></tr>';
190 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center"><a href="/frs/monitor.php?filemodule_id='.
191 db_result($result,$i,'filemodule_id').
192 '&group_id='.db_result($result,$i,'group_id'). '&stop=1"><img src="'. $HTML->imgroot.'/ic/trash.png" height="16" width="16" '.
193 'BORDER=0"></a></td><td width="99%"><a href="/frs/?group_id='.
194 db_result($result,$i,'group_id').'">'.
195 db_result($result,$i,'name').'</a>';
197 $last_group=db_result($result,$i,'group_id');
201 echo $HTML->boxBottom();
203 //second column of "my" page
206 </td><td valign="top" width="50%">
212 echo $HTML->boxTop($Language->getText('my', 'tasks'));
213 $projectTasksForUser = new ProjectTasksForUser(session_get_user());
214 $userTasks =& $projectTasksForUser->getTasksByGroupProjectName();
216 if (count($userTasks) > 0) {
217 foreach ($userTasks as $task) {
219 /* Deduce summary style */
222 if ($task->getPercentComplete()==100) {
223 $style_begin='<span style="text-decoration:underline">';
224 $style_end='</span>';
226 //if ($task->getProjectGroup()->getID() != $last_group) {
227 $projectGroup =& $task->getProjectGroup();
228 $group =& $projectGroup->getGroup();
229 if ($projectGroup->getID() != $last_group) {
231 <tr><td colspan="2"><strong><a href="/pm/task.php?group_id='.
233 '&group_project_id='.
234 $projectGroup->getID().'">'.
235 $group->getPublicName().' - '.
236 $projectGroup->getName().'</a></strong></td></tr>';
239 <tr style="background-color:'.html_get_priority_color($task->getPriority()).'">
240 <td width="10%">'.$task->getID().'</td>
241 <td><a href="/pm/task.php?func=detailtask&project_task_id='.
243 '&group_id='.$group->getID().
244 '&group_project_id='.$projectGroup->getID().'">'.$style_begin.$task->getSummary().$style_end.'</a>';
246 $last_group = $projectGroup->getID();
250 <strong>'.$Language->getText('my', 'no_open_tasks').'</strong>';
258 This needs to be updated manually to display any given survey
261 $sql="SELECT * from survey_responses ".
262 "WHERE survey_id='1' AND user_id='".user_getid()."' AND group_id='1'";
264 $result=db_query($sql);
266 echo $HTML->boxMiddle($Language->getText('my', 'survey'),false,false);
268 if (db_numrows($result) < 1) {
272 <strong>'.$Language->getText('my','survey_taken').'</strong>';
276 * Pending projects and news bytes
278 $admingroup = group_get_object (1) ;
279 if (!$admingroup || !is_object($admingroup)) {
280 //don't have perm to see this
281 } elseif ($admingroup->isError()) {
282 //don't have perm to see this
284 $perm =& $admingroup->getPermission( session_get_user() );
285 if ($perm && is_object($perm) && $perm->isAdmin()) {
286 $sql="SELECT group_name FROM groups where status='P';";
287 $result=db_query($sql);
288 $rows=db_numrows($result);
290 echo $HTML->boxMiddle($Language->getText('my','pending_projects'), false, false);
293 echo $Language->getText('my','pending_projects_1');
295 echo $Language->getText('my','pending_projects_2',$rows);
298 echo " <a href=\"/admin/approve-pending.php\">";
299 echo $Language->getText('my','pending_projects_3');
304 $newsgroup = group_get_object ($GLOBALS['sys_news_group']) ;
305 if (!$newsgroup || !is_object($newsgroup)) {
306 //don't have perm to see this
307 } elseif ($newsgroup->isError()) {
308 //don't have perm to see this
310 $perm =& $newsgroup->getPermission( session_get_user() );
311 if ($perm && is_object($perm) && $perm->isAdmin()) {
312 $sql="SELECT * FROM news_bytes nb, groups g WHERE nb.is_approved=0 and nb.group_id = g.group_id and g.status = 'A'";
313 $result=db_query($sql);
314 $rows=db_numrows($result);
316 echo $HTML->boxMiddle($Language->getText('my','pending_news_bytes'), false, false);
319 echo $Language->getText('my','pending_news_bytes_1');
321 echo $Language->getText('my','pending_news_bytes_2',$rows);
324 echo " <a href=\"/news/admin/?group_id=".$GLOBALS['sys_news_group']."\">";
326 echo $Language->getText('my','pending_news_bytes_3');
334 echo $HTML->boxMiddle($Language->getText('my', 'bookmarks'),false,false);
336 $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where ".
337 "user_id='". user_getid() ."' ORDER BY bookmark_title");
338 $rows=db_numrows($result);
339 if (!$result || $rows < 1) {
341 <strong>'.$Language->getText('my', 'no_bookmarks').'</strong>';
344 for ($i=0; $i<$rows; $i++) {
346 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center">
347 <a href="/my/bookmark_delete.php?bookmark_id='. db_result($result,$i,'bookmark_id') .'">
348 <img src="'.$HTML->imgroot.'/ic/trash.png" height="16" width="16" border="0" alt="" /></a></td>
349 <td><strong><a href="'. db_result($result,$i,'bookmark_url') .'">'.
350 db_result($result,$i,'bookmark_title') .'</a></strong>
351 <span style="font-size:small"><a href="/my/bookmark_edit.php?bookmark_id='. db_result($result,$i,'bookmark_id') .'">['.$Language->getText('general','edit').']</a></span>';
359 echo $HTML->boxMiddle($Language->getText('my', 'projects'),false,false);
360 // Include both groups and foundries; developers should be similarly
361 // aware of membership in either.
362 $result = db_query("SELECT groups.group_name,"
364 . "groups.unix_group_name,"
367 . "user_group.admin_flags "
368 . "FROM groups,user_group "
369 . "WHERE groups.group_id=user_group.group_id "
370 . "AND user_group.user_id='". user_getid() ."' "
371 . "AND groups.status='A' "
372 . "ORDER BY group_name");
373 $rows=db_numrows($result);
374 if (!$result || $rows < 1) {
375 echo '<strong>'.$Language->getText('my', 'no_projects').'</strong>';
378 for ($i=0; $i<$rows; $i++) {
380 $admin_flags = db_result($result, $i, 'admin_flags');
381 if (stristr($admin_flags, 'A')) {
387 if (db_result($result, $i, 'type_id')==2) {
394 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center">
395 <a href="rmproject.php?group_id='. db_result($result,$i,'group_id') .'">
396 <img src="'.$HTML->imgroot.'ic/'.$img.'" alt="Delete" height="16" width="16" border="0" /></a></td>
397 <td><a href="/'.$type.'/'. db_result($result,$i,'unix_group_name') .'/">'. htmlspecialchars(db_result($result,$i,'group_name')) .'</a>';
400 echo $HTML->boxBottom();
408 <tr><td colspan="2">';
410 echo show_priority_colors_key();
417 echo site_user_footer(array());