$rows = db_numrows($result); if (!$result || $rows < 1) { echo '<BR><I>There are no public subprojects available</I>'; } else { for ($j = 0; $j < $rows; $j++) { echo ' <BR> - <A HREF="/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') . '</A>'; } } } // ######################### Surveys if ($project->usesSurvey()) { print '<HR SIZE="1" NoShade><A href="/survey/?group_id=' . $group_id . '">'; print html_image("images/ic/survey16b.png", '20', '20', array('alt' => $Language->GROUP_SHORT_SURVEY)); print " " . $Language->GROUP_LONG_SURVEY . "</A>"; echo ' ( <B>' . project_get_survey_count($group_id) . '</B> surveys )'; } // ######################### CVS if ($project->usesCVS()) { print '<HR SIZE="1" NoShade><A href="/cvs/?group_id=' . $group_id . '">'; print html_image("images/ic/cvs16b.png", '20', '20', array('alt' => $Language->GROUP_SHORT_CVS)); print " " . $Language->GROUP_LONG_CVS . "</A>"; $sql = "SELECT SUM(cvs_commits) AS commits,SUM(cvs_adds) AS adds from stats_project where group_id='{$group_id}'"; $result = db_query($sql); $cvs_commit_num = db_result($result, 0, 0); $cvs_add_num = db_result($result, 0, 1); if (!$cvs_commit_num) { $cvs_commit_num = 0; } if (!$cvs_add_num) { $cvs_add_num = 0;
function project_summary($group_id, $mode, $no_table) { if (!$group_id) { return 'Error - No Group ID'; } if (!$mode) { $mode = 'full'; } $project = project_get_object($group_id); // ################## forums if (!$no_table) { $return .= ' <TABLE BORDER=0 WIDTH="100%"><TR><TD BGCOLOR="#EAECEF">'; } if ($project->usesForum()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/forum/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/notes16.png", "20", "20", array("BORDER" => "0", "ALT" => "Forums")); $return .= ' Forums</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_public_forum_count($group_id) . "</B> messages in "; $return .= "<B>" . project_get_public_forum_message_count($group_id) . "</B> forums )\n"; } } // ##################### Bug tracking if ($project->usesBugs()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/bugs/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/bug16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Bugs")); $return .= ' Bug Tracker</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_open_bug_count($group_id) . "</B>"; $return .= " open bugs, <B>" . project_get_total_bug_count($group_id) . "</B> total )"; } } // ##################### Support Manager if ($project->usesSupport()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/support/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/support16b.jpg", "20", "20", array("BORDER" => "0", "ALT" => "Support")); $return .= ' Tech Support</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_open_support_count($group_id) . "</B>"; $return .= " open requests, <B>" . project_get_total_support_count($group_id) . "</B> total )"; } } // ##################### Feature Request if ($project->usesFeature()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/feature/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/support16b.jpg", "20", "20", array("BORDER" => "0", "ALT" => "Feature Requests")); $return .= ' Feature Requests</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_open_feature_count($group_id) . "</B>"; $return .= " open requests, <B>" . project_get_total_feature_count($group_id) . "</B> total )"; } } // ##################### Doc Manager if ($project->usesDocman()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/docman/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/docman16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Docs")); $return .= ' Doc Manager</A>'; } // ##################### Patch Manager if ($project->usesPatch()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/patch/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/patch.png", "20", "20", array("BORDER" => "0", "ALT" => "Patches")); $return .= ' Patch Manager</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_open_patch_count($group_id) . "</B>"; $return .= " open patches, <B>" . project_get_total_patch_count($group_id) . "</B> total )"; } } // ##################### Mailing lists if ($project->usesMail()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/mail/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/mail16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Mail Lists")); $return .= ' Mailing Lists</A>'; if ($mode != 'compact') { $return .= " ( <B>" . project_get_mail_list_count($group_id) . "</B> public lists )"; } } // ##################### Task Manager if ($project->usesPm()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/pm/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/taskman16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Tasks")); $return .= ' Task Manager</A>'; if ($mode != 'compact') { //get a list of publicly available projects $sql = "SELECT * FROM project_group_list WHERE group_id='{$group_id}' AND is_public=1"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { $return .= '<BR><I>There are no public subprojects available</I>'; } else { for ($j = 0; $j < $rows; $j++) { $return .= ' <BR> - <A HREF="http://' . $GLOBALS['sys_default_host'] . '/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') . '</A>'; } db_free_result($result); } } } // ######################### Surveys if ($project->usesSurvey()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/survey/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/survey16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Surveys")); $return .= " Surveys</A>"; if ($mode != 'compact') { $return .= ' ( <B>' . project_get_survey_count($group_id) . '</B> surveys )'; } } // ######################### CVS if ($project->usesCVS()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/cvs/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/cvs16b.png", "20", "20", array("BORDER" => "0", "ALT" => "CVS")); $return .= " CVS Tree</A>"; if ($mode != 'compact') { $sql = "SELECT SUM(cvs_commits) AS commits,SUM(cvs_adds) AS adds from stats_project where group_id='{$group_id}'"; $result = db_query($sql); $return .= ' ( <B>' . db_result($result, 0, 0) . '</B> commits, <B>' . db_result($result, 0, 1) . '</B> adds )'; } } // 2002-03-03 by helix // ######################## Screenshots if ($project->usesScreenshots()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/screenshots/?group_id=' . $group_id . '">'; $return .= html_image("images/ic/frame_image16b.png", "20", "20", array("BORDER" => "0", "ALT" => "Screenshots")); $return .= " Screenshots</A>"; if ($mode != 'compact') { $return .= ' ( <B>' . project_get_screenshots_count($group_id) . '</B> screenshots )'; } } // ######################## Released Files if ($project->isActive()) { $return .= ' <HR SIZE="1" NoShade>'; $return .= '<A href="http://' . $GLOBALS['sys_default_host'] . '/project/showfiles.php?group_id=' . $group_id . '">'; $return .= html_image("images/ic/ftp16b.png", "20", "20", array("BORDER" => "0", "ALT" => "FTP")); $return .= " Released Files</A>"; } if (!$no_table) { $return .= ' </TD></TR></TABLE>'; } return $return; }
/** * 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 .= ' <table border=0 width="100%"><tr><td class="tablecontent">'; } // ################## ArtifactTypes $return .= '<a href="' . util_make_url('/tracker/?group_id=' . $group_id) . '">'; $return .= html_image("ic/tracker20g.png", '20', '20', array('alt' => 'Tracker')); $return .= ' Tracker</a>'; if ($mode != 'compact') { $result = db_query("SELECT agl.*,aca.count,aca.open_count\n\t\tFROM artifact_group_list agl\n\t\tLEFT JOIN artifact_counts_agg aca USING (group_artifact_id) \n\t\tWHERE agl.group_id='{$group_id}'\n\t\tAND agl.is_public=1\n\t\tORDER BY group_artifact_id ASC"); $rows = db_numrows($result); if (!$result || $rows < 1) { $return .= '<br /><em>' . _('There are no public trackers available') . '</em>'; } else { for ($j = 0; $j < $rows; $j++) { $return .= '<p> - ' . 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('(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', '(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', (int) db_result($result, $j, 'open_count')), (int) db_result($result, $j, 'open_count'), (int) db_result($result, $j, 'count')); $return .= '</p>'; } } } // ##################### Forums if ($project->usesForum()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/forum/?group_id=' . $group_id) . '">'; $return .= html_image("ic/forum20g.png", "20", "20", array("border" => "0", "ALT" => "Forums")); $return .= ' Forums</a>'; if ($mode != 'compact') { $return .= " ( <strong>" . project_get_public_forum_message_count($group_id) . "</strong> messages in "; $return .= "<strong>" . project_get_public_forum_count($group_id) . "</strong> forums )\n"; } } // ##################### Doc Manager if ($project->usesDocman()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/docman/?group_id=' . $group_id) . '">'; $return .= html_image("ic/docman16b.png", "20", "20", array("border" => "0", "alt" => "Docs")); $return .= ' Doc Manager</a>'; } // ##################### Mailing lists if ($project->usesMail()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/mail/?group_id=' . $group_id) . '">'; $return .= html_image("ic/mail16b.png", "20", "20", array("border" => "0", "alt" => "Mail Lists")); $return .= ' Mailing Lists</a>'; if ($mode != 'compact') { $return .= " ( <strong>" . project_get_mail_list_count($group_id) . "</strong> public lists )"; } } // ##################### Task Manager if ($project->usesPm()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/pm/?group_id=' . $group_id) . '">'; $return .= html_image("ic/taskman20g.png", "20", "20", array("border" => "0", "ALT" => "Tasks")); $return .= ' Task Manager</a>'; if ($mode != 'compact') { //get a list of publicly available projects $sql = "SELECT * FROM project_group_list WHERE group_id='{$group_id}' AND is_public=1"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { $return .= '<br /><em>There are no public subprojects available</em>'; } else { for ($j = 0; $j < $rows; $j++) { $return .= ' <br /> - ' . 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 .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/survey/?group_id=' . $group_id) . '">'; $return .= html_image("ic/survey16b.png", "20", "20", array("border" => "0", "alt" => "Surveys")); $return .= " Surveys</a>"; if ($mode != 'compact') { $return .= ' ( <strong>' . project_get_survey_count($group_id) . '</strong> surveys )'; } } // ######################### SCM if ($project->usesSCM()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/scm/?group_id=' . $group_id) . '">'; $return .= html_image("ic/cvs16b.png", "20", "20", array("border" => "0", "ALT" => "SCM")); $return .= " SCM Tree</a>"; if ($mode != 'compact') { $sql = "SELECT SUM(commits) AS commits,SUM(adds) AS adds from stats_cvs_group where group_id='{$group_id}'"; $result = db_query($sql); $return .= ' ( <strong>' . db_result($result, 0, 0) . '</strong> commits, <strong>' . db_result($result, 0, 1) . '</strong> adds )'; } } // ######################## Released Files if ($project->isActive()) { $return .= ' <hr size="1" />'; $return .= '<a href="' . util_make_url('/project/showfiles.php?group_id=' . $group_id) . '">'; $return .= html_image("ic/ftp16b.png", "20", "20", array("border" => "0", "alt" => "FTP")); $return .= " Released Files</a>"; } if (!$no_table) { $return .= ' </td></tr></table>'; } return $return; }
$rows = db_numrows($result); if (!$result || $rows < 1) { echo '<br /><em>' . _('There are no public subprojects available') . '</em>'; } else { for ($j = 0; $j < $rows; $j++) { echo ' <br /> - ' . 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')); } } } // ######################### Surveys if ($project->usesSurvey()) { print '<hr size="1" /><a href="' . util_make_url('/survey/?group_id=' . $group_id) . '">'; print html_image('ic/survey16b.png', '20', '20', array('alt' => _('Surveys'))); print " " . _('Surveys') . "</a>"; echo ' ( <strong>' . project_get_survey_count($group_id) . '</strong> ' . _('surveys') . ' )'; } // ######################### SCM if ($project->usesSCM()) { print '<hr size="1" /><a href="' . util_make_url('/scm/?group_id=' . $group_id) . '">'; print html_image('ic/cvs16b.png', '20', '20', array('alt' => _('SCM'))); print " " . _('SCM Repository') . "</a>"; /* $result = db_query(" SELECT sum(commits) AS commits,sum(adds) AS adds FROM stats_cvs_group WHERE group_id='$group_id' ", -1, 0, SYS_DB_STATS); $cvs_commit_num = db_result($result,0,0); $cvs_add_num = db_result($result,0,1); if (!$cvs_commit_num) {