.
*/
require_once('Widget.class.php');
/**
* Widget_ProjectPublicAreas
*/
class Widget_ProjectPublicAreas extends Widget {
function Widget_ProjectPublicAreas() {
$this->Widget('projectpublicareas');
}
function getTitle() {
return _('Public Areas');
}
function getContent() {
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$HTML = $GLOBALS['HTML'];
// ################# Homepage Link
echo '
';
if ( util_check_url($project->getHomePage())) {
echo util_make_link ($project->getHomePage(), $HTML->getHomePic(_('Home Page')) . ' ' . _('Project Home Page'), false, true);
} else {
echo util_make_link ('http://' . $project->getHomePage(), $HTML->getHomePic(_('Home Page')) . ' ' . _('Project Home Page'), false, true);
}
echo "
\n";
// ################## ArtifactTypes
if ($project->usesTracker()) {
echo ''."\n";
$link_content = $HTML->getFollowPic(_('Tracker')) . ' ' . _('Tracker');
echo util_make_link ( '/tracker/?group_id=' . $group_id, $link_content);
$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) {
echo "
\n
"._('There are no public trackers available').'';
} else {
echo "\n".'
'."\n";
for ($j = 0; $j < $rows; $j++) {
// tracker REST paths are something like : /tracker/cm/project/A_PROJECT/atid/NUMBER to plan compatibility
// with OSLC-CM server API
$group_artifact_id = db_result($result, $j, 'group_artifact_id');
$tracker_stdzd_uri = util_make_url('/tracker/cm/project/'. $project->getUnixName() .'/atid/'. $group_artifact_id);
echo "\t".'- '."\n";
print ''."\n";
echo util_make_link ('/tracker/?atid='. $group_artifact_id . '&group_id='.$group_id.'&func=browse',db_result($result, $j, 'name')) . ' ' ;
echo "\n"; // /owl:sameAs
printf(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'));
echo '
'; //.db_result($result, $j, 'description');
print ''."\n";
echo " \n";
}
echo "
\n";
}
echo "
\n";
}
// ################## forums
if ($project->usesForum()) {
echo '";
}
// ##################### Doc Manager
if ($project->usesDocman()) {
echo '\n";
}
// ##################### Mailing lists
if ($project->usesMail()) {
echo ''."\n";
$link_content = $HTML->getMailPic('') . ' ' . _('Mailing Lists');
print util_make_link( '/mail/?group_id='.$group_id, $link_content);
$n = project_get_mail_list_count($group_id);
echo ' ';
printf(ngettext('(%1$s public mailing list)', '(%1$s public mailing lists)', $n), $n);
echo "\n
\n";
}
// ##################### Task Manager
if ($project->usesPm()) {
echo ''."\n";
$link_content = $HTML->getPmPic('') . ' ' . _('Tasks');
print util_make_link( '/pm/?group_id='.$group_id, $link_content);
$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) {
echo "
\n
"._('There are no public subprojects available').'';
} else {
echo "\n".'
';
for ($j = 0; $j < $rows; $j++) {
echo "\n\t- ";
print 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'));
echo '
' ;
}
echo "\n
";
}
echo "\n
\n";
}
// ######################### Surveys
if ($project->usesSurvey()) {
echo ''."\n";
$link_content = $HTML->getSurveyPic('') . ' ' . _('Surveys');
echo util_make_link( '/survey/?group_id='.$group_id, $link_content);
echo ' ('. project_get_survey_count($group_id) .' ' . _('surveys').')';
echo "\n
\n";
}
// ######################### SCM
if ($project->usesSCM()) {
echo '\n";
}
// ######################### Plugins
$hook_params = array ();
$hook_params['group_id'] = $group_id;
plugin_hook ("project_public_area", $hook_params);
// ######################## AnonFTP
// CB hide FTP if desired
if ($project->usesFTP()) {
if ($project->isActive()) {
echo '\n";
}
}
//webcalendar
plugin_hook("cal_link_group",$group_id);
}
function canBeUsedByProject(&$project) {
return true;
}
function getDescription() {
return _('List all available services for this project along with some information next to it. Click on any of this item to access a service.
The role of this area is pretty much equivalent to the Project Main Menu at the top of the screen except that it shows additional information about each of the service (e.g. total number of open bugs, tasks, ...)');
}
}
?>