3 * Project Activity Page
5 * Copyright 2006 (c) GForge, LLC
11 require_once('../env.inc.php');
12 require_once $gfwww.'include/pre.php';
16 Written by dtype Oct. 1999
18 $group_id = getIntFromRequest("group_id");
19 $received_begin = getStringFromRequest("start_date");
20 $received_end = getStringFromRequest("end_date");
21 $show=getArrayFromRequest("show");
23 $date_format = _('%Y-%m-%d') ;
25 if (!$received_begin || $received_begin==0) {
26 $begin = (time()-(30*86400));
27 $rendered_begin = strftime($date_format, $begin) ;
29 $tmp = strptime ($received_begin, $date_format);
31 $begin = (time()-(30*86400));
32 $rendered_begin = strftime($date_format, $begin) ;
34 $begin = mktime (0,0,0,$tmp['tm_mon']+1,$tmp['tm_mday'],$tmp['tm_year']);
35 $rendered_begin = $received_begin ;
39 if (!$received_end || $received_end==0) {
41 $rendered_end = strftime($date_format, $end) ;
43 $tmp = strptime ($received_end, $date_format);
46 $rendered_end = strftime($date_format, $end) ;
48 $end = mktime (0,0,0,$tmp['tm_mon']+1,$tmp['tm_mday'],$tmp['tm_year']) + 86400;
49 $rendered_end = $received_end ;
58 $rendered_end=$rendered_begin;
65 $group=group_get_object($group_id);
66 if (!$group || !is_object($group)) {
67 exit_permission_denied();
70 site_project_header(array('title'=>_('Activity'),'group'=>$group_id,'toptab'=>'activity'));
75 if ($GLOBALS['sys_use_forum'] && $group->usesForum ()) {
77 $texts[]=_('Forum Post');
80 if ($GLOBALS['sys_use_tracker'] && $group->usesTracker ()) {
82 $texts[]=_('Tracker Opened');
83 $ids[]='trackerclose';
84 $texts[]=_('Tracker Closed');
87 if ($GLOBALS['sys_use_news'] && $group->usesNews ()) {
92 if ($GLOBALS['sys_use_scm'] && $group->usesSCM ()) {
94 $texts[]=_('Commits');
97 if ($GLOBALS['sys_use_frs'] && $group->usesFRS ()) {
99 $texts[]=_('FRS Release');
102 if (count($show) < 1) {
109 $res=db_query_params ('SELECT * FROM activity_vw WHERE activity_date BETWEEN $1 AND $2
110 AND group_id=$3 AND section = ANY ($4) ORDER BY activity_date DESC',
114 db_string_array_to_any_clause ($section)));
118 while ($arr =& db_fetch_array($res)) {
122 // If plugins wants to add activities.
123 $hookParams['group'] = $group_id ;
124 $hookParams['results'] = &$results;
125 $hookParams['show'] = &$show;
126 $hookParams['begin'] = $begin;
127 $hookParams['end'] = $end;
128 $hookParams['ids'] = &$ids;
129 $hookParams['texts'] = &$texts;
130 plugin_hook ("activity", $hookParams) ;
132 if (count($show) < 1) {
135 foreach ($show as $showthis) {
136 if (array_search($showthis,$ids) === false) {
137 exit_error('Error','Invalid Data Passed to query');
140 $multiselect=html_build_multiple_select_box_from_arrays($ids,$texts,'show[]',$show,5,false);
144 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
145 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
146 <table border="0" cellspacing="0" cellpadding="3">
148 <td><strong><?php echo _('Activity') ?></strong></td>
149 <td><strong><?php echo _('Start') ?></strong></td>
150 <td><strong><?php echo _('End') ?></strong></td>
154 <td><?php echo $multiselect; ?></td>
155 <td valign="top"><input name="start_date"
156 value="<?php echo $rendered_begin; ?>" size="10" maxlength="10" /></td>
157 <td valign="top"><input name="end_date"
158 value="<?php echo $rendered_end; ?>" size="10" maxlength="10" /></td>
159 <td valign="top"><input type="submit" name="submit"
160 value="<?php echo _('Submit'); ?>" /></td>
165 if (count($results)<1) {
166 echo _('No Activity Found');
169 function date_compare($a, $b)
171 if ($a['activity_date'] == $b['activity_date']) {
174 return ($a['activity_date'] > $b['activity_date']) ? -1 : 1;
177 usort($results, 'date_compare');
184 $res=db_query_params ('SELECT * FROM activity_vw WHERE activity_date BETWEEN $1 AND $2
185 AND group_id=$3 AND section = ANY ($4) ORDER BY activity_date DESC',
189 db_string_array_to_any_clause ($show)));
192 $rows=db_numrows($res);
194 echo _('No Activity Found');
198 $theader[]=_('Time');
199 $theader[]=_('Activity');
202 echo $HTML->listTableTop($theader);
206 foreach ($results as $arr) {
207 if ($last_day != strftime($date_format,$arr['activity_date'])) {
208 // echo $HTML->listTableBottom($theader);
209 echo '<tr class="tableheading"><td colspan="3">'.strftime($date_format,$arr['activity_date']).'</td></tr>';
210 // echo $HTML->listTableTop($theader);
211 $last_day=strftime($date_format,$arr['activity_date']);
213 switch ($arr['section']) {
215 $icon=html_image("ic/cvs16b.png","20","20",array("border"=>"0","alt"=>"SCM"));
216 $url=util_make_link ('/tracker/?func=detail&atid='.$arr['ref_id'].'&aid='.$arr['subref_id'].'&group_id='.$arr['group_id'],_('Commit for Tracker Item').' [#'.$arr['subref_id'].'] '.$arr['description']);
219 case 'trackeropen': {
220 $icon=html_image("ic/tracker20g.png",'20','20',array('alt'=>'Tracker'));
221 $url=util_make_link ('/tracker/?func=detail&atid='.$arr['ref_id'].'&aid='.$arr['subref_id'].'&group_id='.$arr['group_id'],_('Tracker Item').' [#'.$arr['subref_id'].' '.$arr['description'].' ] '._('Opened'));
224 case 'trackerclose': {
225 $icon=html_image("ic/tracker20g.png",'20','20',array('alt'=>'Tracker'));
226 $url=util_make_link ('/tracker/?func=detail&atid='.$arr['ref_id'].'&aid='.$arr['subref_id'].'&group_id='.$arr['group_id'],_('Tracker Item').' [#'.$arr['subref_id'].' '.$arr['description'].' ] '._('Closed'));
230 $icon=html_image("ic/cvs16b.png","20","20",array("border"=>"0","alt"=>"SCM"));
231 $url=util_make_link ('/frs/?release_id='.$arr['subref_id'].'&group_id='.$arr['group_id'],_('FRS Release').' '.$arr['description']);
235 $icon=html_image("ic/forum20g.png","20","20",array("border"=>"0","alt"=>"Forum"));
236 $url=util_make_link ('/forum/message.php?msg_id='.$arr['subref_id'].'&group_id='.$arr['group_id'],_('Forum Post ').' '.$arr['description']);
240 $icon=html_image("ic/write16w.png","20","20",array("border"=>"0","alt"=>"News"));
241 $url=util_make_link ('/forum/forum.php?forum_id='.$arr['subref_id'],_('News').' '.$arr['description']);
245 $icon = isset($arr['icon']) ? $arr['icon'] : '';
246 $url = '<a href="'.$arr['link'].'">'.$arr['title'].'</a>';
250 echo '<tr '. $HTML->boxGetAltRowStyle($j++) . '>
251 <td> '.date('H:i:s',$arr['activity_date']).'</td>
252 <td>'.$icon .' '.$url.'</td><td>';
253 if (isset($arr['user_name']) && $arr['user_name']) {
254 echo util_make_link_u($arr['user_name'],$arr['user_id'],$arr['realname']);
256 echo $arr['realname'];
261 echo $HTML->listTableBottom($theader);
265 site_project_footer(array());