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');
24 * Widget_ProjectMembers
26 class Widget_ProjectInfo extends Widget {
27 public function __construct() {
28 $this->Widget('projectinfo');
30 public function getTitle() {
31 return _('Project Info');
33 public function getContent() {
34 $request =& HTTPRequest::instance();
35 $group_id = $request->get('group_id');
36 $pm = ProjectManager::instance();
37 $project = $pm->getProject($group_id);
39 if (forge_get_config('use_project_tags')) {
40 $list_tag = list_project_tag($group_id);
41 echo '<p>'.html_image('ic/tag.png'). ' ';
43 print _('Tags').': '. $list_tag;
46 $project = group_get_object($group_id);
47 if (forge_check_perm ('project_admin', $project->getID())) {
48 print '<a href="/project/admin/?group_id=' . $group_id . '" >' . _('No tag defined for this project') . '</a>.';
51 print _('No tag defined for this project');
57 if(forge_get_config('use_trove')) {
59 print stripslashes(trove_getcatlisting($group_id,0,1,1))."\n";
63 $project_start_date = $project->getStartDate();
64 print(_('Registered: ') .
65 '<span property="doap:created" content="'.date('Y-m-d', $project_start_date).'">'.
66 date(_('Y-m-d H:i'), $project_start_date).
69 // Get the activity percentile
70 // CB hide stats if desired
71 if ($project->usesStats()) {
72 $actv = db_query_params ('SELECT ranking FROM project_weekly_metric WHERE group_id=$1',
74 if (db_numrows($actv) > 0){
75 $actv_res = db_result($actv,0,"ranking");
82 print '<br />'.sprintf (_('Activity Ranking: %d'), $actv_res)."\n";
83 print '<br />'.sprintf(_('View project <a href="%1$s" >Statistics</a>'),util_make_url ('/project/stats/?group_id='.$group_id))."\n";
84 if ( ($project->usesTracker() && forge_get_config('use_tracker')) || ($project->usesPm() && forge_get_config('use_pm')) ) {
85 print sprintf(_(' or <a href="%1$s">Activity</a>'),util_make_url ('/project/report/?group_id='.$group_id))."\n";
87 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";
90 if(forge_get_config('use_people')) {
91 $jobs_res = db_query_params ('SELECT name
92 FROM people_job,people_job_category
93 WHERE people_job.category_id=people_job_category.category_id
94 AND people_job.status_id=1
100 $num=db_numrows($jobs_res);
104 ngettext('HELP WANTED: This project is looking for a <a href="%1$s">"%2$s"</a>.',
105 'HELP WANTED: This project is looking for people to fill <a href="%1$s">several different positions</a>.',
107 util_make_url ('/people/?group_id='.$group_id),
108 db_result($jobs_res,0,"name"));
110 //print '<div rel="fusionforge:has_job" typeof="fusionforge:Job" xmlns:fusionforge="http://fusionforge.org/fusionforge#">';
111 //print '<span rel="dc:title" content="'. db_result($jobs_res,0,"name").'" xmlns:dc="http://purl.org/dc/elements/1.1/">';
114 //end of job description part
120 $hook_params = array();
121 $hook_params['group_id'] = $group_id;
122 plugin_hook("project_after_description",$hook_params);
123 plugin_hook('hierarchy_views', array($group_id, 'home'));
126 public function canBeUsedByProject(&$project) {
129 function getDescription() {
130 return _('Some infos about the project.');