0) { for ($i=0; $i<$rows; $i++) { $project_agg_arr[db_result($res,$i,'type')]=db_result($res,$i,'count'); } } $project_agg_arr_is_set=true; } /** * project_getaggvalue() - Get a projects aggregate value for a specific type * * @param int The group ID * @param string The type * @access private */ function project_getaggvalue($group_id,$type) { global $project_agg_arr,$project_agg_arr_is_set; if (!$project_agg_arr_is_set) { project_setup_agg($group_id); } // Remove warning if (@$project_agg_arr[$type]) { return "$project_agg_arr[$type]"; } else { return '0'; } } /** * project_get_mail_list_count() - Get the number of mailing lists for a project. * * @param int The group ID */ function project_get_mail_list_count($group_id) { return project_getaggvalue($group_id,'mail'); } /** * project_get_survey_count() - Get the number of surveys for a project. * * @param int The group ID */ function project_get_survey_count($group_id) { return project_getaggvalue($group_id,'surv'); } /** * project_get_public_forum_count() - Get the number of public forums for a project. * * @param int The group ID */ function project_get_public_forum_count($group_id) { return project_getaggvalue($group_id, 'fora'); } /** * project_get_public_forum_message_count() - Get the number of messages within public forums for a project. * * @param int The group ID */ function project_get_public_forum_message_count($group_id) { return project_getaggvalue($group_id, 'fmsg'); } /** * project_summary() - Build a project summary box that projects can insert into their project pages * * @param int The group ID * @param string How to return the results. * @param bool Whether to return the results within an HTML table or not */ function project_summary($group_id,$mode,$no_table) { if (!$group_id) { return 'Error - No Group ID'; } if (!$mode) { $mode='full'; } $project =& group_get_object($group_id); if (!$project || !is_object($project)) { return 'Could Not Create Project Object'; } elseif ($project->isError()) { return $project->getErrorMessage(); } if (!$no_table) { $return .= '
';
}
// ################## ArtifactTypes
$return .= '';
$return .= html_image("ic/tracker20g.png",'20','20',array('alt'=>'Tracker'));
$return .= ' Tracker';
if ($mode != 'compact') {
$result=db_query_params ('SELECT agl.*,aca.count,aca.open_count
FROM artifact_group_list agl
LEFT JOIN artifact_counts_agg aca USING (group_artifact_id)
WHERE agl.group_id=$1
AND agl.is_public=1
ORDER BY group_artifact_id ASC',
array($group_id));
$rows = db_numrows($result);
if (!$result || $rows < 1) {
$return .= ' '._('There are no public trackers available').''; } else { for ($j = 0; $j < $rows; $j++) { $return .= ' - '.util_make_link ('/tracker/?atid='. db_result($result, $j, 'group_artifact_id') . '&group_id='.$group_id.'&func=browse',db_result($result, $j, 'name')); $return .= sprintf(ngettext('(%1$s open / %2$s total)', '(%1$s open / %2$s total)', (int) db_result($result, $j, 'open_count')), (int) db_result($result, $j, 'open_count'), (int) db_result($result, $j, 'count')) ; $return .= ' '; } } } // ##################### Forums if ($project->usesForum()) { $return .= ''; $return .= ''; $return .= html_image("ic/forum20g.png","20","20",array("border"=>"0","alt"=>"Forums")); $return .= ' Forums'; if ($mode != 'compact') { $return .= " ( ". project_get_public_forum_message_count($group_id) ." messages in "; $return .= "". project_get_public_forum_count($group_id) ." forums )\n"; } } // ##################### Doc Manager if ($project->usesDocman()) { $return .= ' '; $return .= ''; $return .= html_image("ic/docman16b.png","20","20",array("border"=>"0","alt"=>"Docs")); $return .= ' Doc Manager'; } // ##################### Mailing lists if ($project->usesMail()) { $return .= ' '; $return .= ''; $return .= html_image("ic/mail16b.png","20","20",array("border"=>"0","alt"=>"Mail Lists")); $return .= ' Mailing Lists'; if ($mode != 'compact') { $return .= " ( ". project_get_mail_list_count($group_id) ." public lists )"; } } // ##################### Task Manager if ($project->usesPm()) { $return .= ' '; $return .= ''; $return .= html_image("ic/taskman20g.png","20","20",array("border"=>"0","alt"=>"Tasks")); $return .= ' Task Manager'; if ($mode != 'compact') { //get a list of publicly available projects $result = db_query_params ('SELECT * FROM project_group_list WHERE group_id=$1 AND is_public=1', array ($group_id)); $rows = db_numrows($result); if (!$result || $rows < 1) { $return .= ' There are no public subprojects available'; } else { for ($j = 0; $j < $rows; $j++) { $return .= ' - '.util_make_link ('/pm/task.php?group_project_id='.db_result($result, $j, 'group_project_id').'&group_id='.$group_id.'&func=browse',db_result($result, $j, 'project_name')); } db_free_result($result); } } } // ######################### Surveys if ($project->usesSurvey()) { $return .= ' '; $return .= ''; $return .= html_image("ic/survey16b.png","20","20",array("border"=>"0","alt"=>"Surveys")); $return .= " Surveys"; if ($mode != 'compact') { $return .= ' ( '. project_get_survey_count($group_id) .' surveys )'; } } // ######################### SCM if ($project->usesSCM()) { $return .= ' '; $return .= ''; $return .= html_image("ic/cvs16b.png","20","20",array("border"=>"0","alt"=>"SCM")); $return .= " SCM Tree"; if ($mode != 'compact') { $result = db_query_params ('SELECT SUM(commits) AS commits,SUM(adds) AS adds from stats_cvs_group where group_id=$1', array ($group_id)); $return .= ' ( '.db_result($result,0,0).' commits, '.db_result($result,0,1).' adds )'; } } // ######################## Released Files if ($project->isActive()) { $return .= ' '; $return .= ''; $return .= html_image("ic/ftp16b.png","20","20",array("border"=>"0","alt"=>"FTP")); $return .= " Released Files"; } if (!$no_table) { $return .= ' |