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 //echo "<a href=. onclick=\"window.open('/pm/ganttofuser.php')\"><strong>".$Language->getText('pm_include_grouphtml','gantt_chart')."</strong></a>";
214 $projectTasksForUser = new ProjectTasksForUser(session_get_user());
215 $userTasks =& $projectTasksForUser->getTasksByGroupProjectName();
217 if (count($userTasks) > 0) {
218 foreach ($userTasks as $task) {
220 /* Deduce summary style */
223 if ($task->getPercentComplete()==100) {
224 $style_begin='<span style="text-decoration:underline">';
225 $style_end='</span>';
227 //if ($task->getProjectGroup()->getID() != $last_group) {
228 $projectGroup =& $task->getProjectGroup();
229 $group =& $projectGroup->getGroup();
230 if ($projectGroup->getID() != $last_group) {
232 <tr><td colspan="2"><strong><a href="/pm/task.php?group_id='.
234 '&group_project_id='.
235 $projectGroup->getID().'">'.
236 $group->getPublicName().' - '.
237 $projectGroup->getName().'</a></strong></td></tr>';
240 <tr style="background-color:'.html_get_priority_color($task->getPriority()).'">
241 <td width="10%">'.$task->getID().'</td>
242 <td><a href="/pm/task.php?func=detailtask&project_task_id='.
244 '&group_id='.$group->getID().
245 '&group_project_id='.$projectGroup->getID().'">'.$style_begin.$task->getSummary().$style_end.'</a>';
247 $last_group = $projectGroup->getID();
251 <strong>'.$Language->getText('my', 'no_open_tasks').'</strong>';
259 This needs to be updated manually to display any given survey
262 $sql="SELECT * from survey_responses ".
263 "WHERE survey_id='1' AND user_id='".user_getid()."' AND group_id='1'";
265 $result=db_query($sql);
267 echo $HTML->boxMiddle($Language->getText('my', 'survey'),false,false);
269 if (db_numrows($result) < 1) {
273 <strong>'.$Language->getText('my','survey_taken').'</strong>';
277 * Pending projects and news bytes
279 $admingroup = group_get_object (1) ;
280 if (!$admingroup || !is_object($admingroup)) {
281 //don't have perm to see this
282 } elseif ($admingroup->isError()) {
283 //don't have perm to see this
285 $perm =& $admingroup->getPermission( session_get_user() );
286 if ($perm && is_object($perm) && $perm->isAdmin()) {
287 $sql="SELECT group_name FROM groups where status='P';";
288 $result=db_query($sql);
289 $rows=db_numrows($result);
291 echo $HTML->boxMiddle($Language->getText('my','pending_projects'), false, false);
294 echo $Language->getText('my','pending_projects_1');
296 echo $Language->getText('my','pending_projects_2',$rows);
299 echo " <a href=\"/admin/approve-pending.php\">";
300 echo $Language->getText('my','pending_projects_3');
305 $newsgroup = group_get_object ($GLOBALS['sys_news_group']) ;
306 if (!$newsgroup || !is_object($newsgroup)) {
307 //don't have perm to see this
308 } elseif ($newsgroup->isError()) {
309 //don't have perm to see this
311 $perm =& $newsgroup->getPermission( session_get_user() );
312 if ($perm && is_object($perm) && $perm->isAdmin()) {
313 $sql="SELECT * FROM news_bytes nb, groups g WHERE nb.is_approved=0 and nb.group_id = g.group_id and g.status = 'A'";
314 $result=db_query($sql);
315 $rows=db_numrows($result);
317 echo $HTML->boxMiddle($Language->getText('my','pending_news_bytes'), false, false);
320 echo $Language->getText('my','pending_news_bytes_1');
322 echo $Language->getText('my','pending_news_bytes_2',$rows);
325 echo " <a href=\"/news/admin/?group_id=".$GLOBALS['sys_news_group']."\">";
327 echo $Language->getText('my','pending_news_bytes_3');
335 echo $HTML->boxMiddle($Language->getText('my', 'bookmarks'),false,false);
337 $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where ".
338 "user_id='". user_getid() ."' ORDER BY bookmark_title");
339 $rows=db_numrows($result);
340 if (!$result || $rows < 1) {
342 <strong>'.$Language->getText('my', 'no_bookmarks').'</strong>';
345 for ($i=0; $i<$rows; $i++) {
347 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center">
348 <a href="/my/bookmark_delete.php?bookmark_id='. db_result($result,$i,'bookmark_id') .'">
349 <img src="'.$HTML->imgroot.'/ic/trash.png" height="16" width="16" border="0" alt="" /></a></td>
350 <td><strong><a href="'. db_result($result,$i,'bookmark_url') .'">'.
351 db_result($result,$i,'bookmark_title') .'</a></strong>
352 <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>';
360 echo $HTML->boxMiddle($Language->getText('my', 'projects'),false,false);
361 // Include both groups and foundries; developers should be similarly
362 // aware of membership in either.
363 $result = db_query("SELECT groups.group_name,"
365 . "groups.unix_group_name,"
368 . "user_group.admin_flags "
369 . "FROM groups,user_group "
370 . "WHERE groups.group_id=user_group.group_id "
371 . "AND user_group.user_id='". user_getid() ."' "
372 . "AND groups.status='A' "
373 . "ORDER BY group_name");
374 $rows=db_numrows($result);
375 if (!$result || $rows < 1) {
376 echo '<strong>'.$Language->getText('my', 'no_projects').'</strong>';
379 for ($i=0; $i<$rows; $i++) {
381 $admin_flags = db_result($result, $i, 'admin_flags');
382 if (stristr($admin_flags, 'A')) {
388 if (db_result($result, $i, 'type_id')==2) {
395 <tr '. $HTML->boxGetAltRowStyle($i) .'><td align="center">
396 <a href="rmproject.php?group_id='. db_result($result,$i,'group_id') .'">
397 <img src="'.$HTML->imgroot.'ic/'.$img.'" alt="Delete" height="16" width="16" border="0" /></a></td>
398 <td><a href="/'.$type.'/'. db_result($result,$i,'unix_group_name') .'/">'. htmlspecialchars(db_result($result,$i,'group_name')) .'</a>';
401 echo $HTML->boxBottom();
409 <tr><td colspan="2">';
411 echo show_priority_colors_key();
418 echo site_user_footer(array());