3 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
5 * This file is a part of Codendi.
7 * Codendi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Codendi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
21 require_once 'Widget.class.php';
26 class Widget_ProjectInfo extends Widget {
27 public function __construct() {
28 $this->Widget('projectinfo');
31 public function getTitle() {
32 return _('Project Info');
35 public function getContent() {
36 $request =& HTTPRequest::instance();
37 $group_id = $request->get('group_id');
38 $pm = ProjectManager::instance();
39 $project = $pm->getProject($group_id);
41 if (forge_get_config('use_project_tags')) {
42 $list_tag = list_project_tag($group_id);
43 echo '<p>'.html_image('ic/tag.png'). ' ';
45 print _('Tags').': '. $list_tag;
48 $project = group_get_object($group_id);
49 if (forge_check_perm ('project_admin', $project->getID())) {
50 print '<a href="/project/admin/?group_id=' . $group_id . '" >' . _('No tag defined for this project') . '</a>.';
53 print _('No tag defined for this project');
59 if(forge_get_config('use_trove')) {
61 print stripslashes(trove_getcatlisting($group_id,0,1,1))."\n";
65 $project_start_date = $project->getStartDate();
66 print(_('Registered: ') .
67 '<span property="doap:created" content="'.date('Y-m-d', $project_start_date).'">'.
68 date(_('Y-m-d H:i'), $project_start_date).
71 // Get the activity percentile
72 // CB hide stats if desired
73 if ($project->usesStats()) {
74 $actv = db_query_params ('SELECT ranking FROM project_weekly_metric WHERE group_id=$1',
76 if (db_numrows($actv) > 0){
77 $actv_res = db_result($actv,0,"ranking");
84 print '<br />'.sprintf (_('Activity Ranking: %d'), $actv_res)."\n";
85 print '<br />'.sprintf(_('View project <a href="%1$s" >Statistics</a>'),util_make_url ('/project/stats/?group_id='.$group_id))."\n";
86 if ( ($project->usesTracker() && forge_get_config('use_tracker')) || ($project->usesPm() && forge_get_config('use_pm')) ) {
87 print sprintf(_(' or <a href="%1$s">Activity</a>'),util_make_url ('/project/report/?group_id='.$group_id))."\n";
89 print '<br />'.sprintf(_('View list of <a href="%1$s">RSS feeds</a> available for this project.'), util_make_url ('/export/rss_project.php?group_id='.$group_id)). ' ' . html_image('ic/rss.png',16,16,array())."\n";
92 if(forge_get_config('use_people')) {
93 $jobs_res = db_query_params ('SELECT name
94 FROM people_job,people_job_category
95 WHERE people_job.category_id=people_job_category.category_id
96 AND people_job.status_id=1
102 $num=db_numrows($jobs_res);
106 ngettext('HELP WANTED: This project is looking for a <a href="%1$s">"%2$s"</a>.',
107 'HELP WANTED: This project is looking for people to fill <a href="%1$s">several different positions</a>.',
109 util_make_url ('/people/?group_id='.$group_id),
110 db_result($jobs_res,0,"name"));
112 //print '<div rel="fusionforge:has_job" typeof="fusionforge:Job" xmlns:fusionforge="http://fusionforge.org/fusionforge#">';
113 //print '<span rel="dc:title" content="'. db_result($jobs_res,0,"name").'" xmlns:dc="http://purl.org/dc/elements/1.1/">';
116 //end of job description part
121 $hook_params = array();
122 $hook_params['group_id'] = $group_id;
123 plugin_hook("project_after_description",$hook_params);
124 plugin_hook('hierarchy_views', array($group_id, 'home'));
127 public function canBeUsedByProject(&$project) {
131 function getDescription() {
132 return _('Some infos about the project.');