3 * Project Management Facility
5 * Copyright 1999/2000, Sourceforge.net Tim Perdue
6 * Copyright 2002 GForge, LLC, Tim Perdue
7 * Copyright 2010, FusionForge Team
8 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
9 * Copyright 2013-2014, Franck Villaume - TrivialDev
10 * http://fusionforge.org
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 require_once $gfcommon.'pm/ProjectGroup.class.php';
30 function pm_header($params) {
31 // XXX ogi: What to do with these?
32 global $group_id,$group_project_id,$HTML,$pg;
34 if (!forge_get_config('use_pm')) {
38 // Required by site_project_header
39 $params['group']=$group_id;
40 $params['toptab']='pm';
42 // Only projects can use the Project Manager, and only if they have it turned on
43 $project = group_get_object($group_id);
44 if (!$project || !is_object($project)) {
48 if (!$project->usesPM()) {
49 exit_disabled('home');
56 if (forge_check_perm('pm_admin', $group_id)) {
57 $labels[] = _('General Admin');
58 $links[] = '/pm/admin/?group_id='.$group_id;
62 $labels[] = _('View Subprojects');
63 $links[] = '/pm/?group_id='.$group_id;
66 if ($group_project_id) {
67 $labels[] = (($pg) ? $pg->getName() : '');
68 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=browse';
70 if (session_loggedin()) {
71 $labels[] = _('Add Task');
72 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=addtask';
75 if ($group_project_id) {
78 $gantt_url = "/pm/task.php?group_id=$group_id&group_project_id=$group_project_id&func=ganttpage";
79 $gantt_title = _('Gantt Chart');
80 $gantt_winopt = 'scrollbars=yes,resizable=yes,toolbar=no,height=' . $gantt_height . ',width=' . $gantt_width;
81 $labels[] = $gantt_title;
82 $links[] = $gantt_url;
83 $attr[] = array('onclick' => 'window.open(this.href, \''.preg_replace('/\s/' , '_' , $gantt_title).'\', \''.$gantt_winopt.'\'); return false;');
86 // Import/Export using CSV files.
87 $labels[] = _('Import/Export CSV');
88 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=csv';
92 if ($pg && is_object($pg) && forge_check_perm ('pm', $pg->getID(), 'manager')) {
93 $labels[] = _('Reporting');
94 $links[] = '/pm/reporting/?group_id='.$group_id;
96 $labels[] = _('Administration');
97 $links[] = '/pm/admin/?group_id='.$group_id.'&group_project_id='.$group_project_id.'&update_pg=1';
99 } elseif (forge_check_perm ('pm_admin', $group_id)) {
100 $labels[] = _('Reporting');
101 $links[] = '/pm/reporting/?group_id='.$group_id;
103 $labels[] = _('Administration');
104 $links[] = '/pm/admin/?group_id='.$group_id;
108 if(!empty($labels)) {
109 $params['submenu'] = $HTML->subMenu($labels, $links, $attr);
112 site_project_header($params);
115 plugin_hook ("blocks", "tasks_".$pg->getName());
119 function pm_footer($params = array()) {
120 site_project_footer($params);
123 class ProjectGroupHTML extends ProjectGroup {
125 function __construct(&$Group, $group_project_id=false, $arr=false) {
126 parent::__construct($Group, $group_project_id, $arr);
129 function statusBox($name='status_id',$checked='xyxy',$show_100=true,$text_100='None') {
130 return html_build_select_box($this->getStatuses(),$name,$checked,$show_100,$text_100);
133 function categoryBox($name='category_id',$checked='xzxz',$show_100=true,$text_100='None') {
134 return html_build_select_box($this->getCategories(),$name,$checked,$show_100,$text_100);
137 function groupProjectBox($name='group_project_id',$checked='xzxz',$show_100=true,$text_100='None') {
138 $res=db_query_params ('SELECT group_project_id,project_name
139 FROM project_group_list
141 array($this->Group->getID()));
142 return html_build_select_box($res,$name,$checked,$show_100,$text_100);
145 function percentCompleteBox($name = 'percent_complete', $selected = 0, $display = true) {
147 $texts = array(_('Not Started'));
149 for ($i = 5; $i < 101; $i += 5) {
152 if ($i == $selected) {
156 $html = html_build_select_box_from_arrays($vals, $texts, $name, $checked_val, false, '', false, '');
164 function showMonthBox($name, $select_month = 0, $display = true) {
180 for ($i = 1; $i <= count($monthlist); $i++) {
182 if ($i == $select_month) {
186 $html = html_build_select_box_from_arrays($vals, $monthlist, $name, $checked_val, false, '', false, '');
194 function showDayBox($name, $day = 1, $display = true) {
197 for ($i = 1; $i <= 31; $i++) {
203 $html = html_build_select_box_from_arrays($vals, $vals, $name, $checked_val, false, '', false, '');
211 function showYearBox($name, $year = 1, $display = true) {
213 $current_year = date('Y');
214 $checked_val = $current_year;
215 for ($i = $current_year - 5; $i <= $current_year + 8; $i++) {
221 $html = html_build_select_box_from_arrays($vals, $vals, $name, $checked_val, false, '', false, '');
229 function showHourBox($name, $hour = 1, $display = true) {
232 for ($i=0; $i<=23; $i++) {
238 $html = html_build_select_box_from_arrays($vals, $vals, $name, $checked_val, false, '', false, '');
246 function showMinuteBox($name, $minute = 0, $display = true) {
249 for ($i = 0; $i <= 45; $i = $i + 15) {
255 $html = html_build_select_box_from_arrays($vals, $vals, $name, $checked_val, false, '', false, '');
263 function renderAssigneeList($assignee_ids) {
264 $techs = user_get_objects($assignee_ids);
266 for ($i=0; $i<count($techs); $i++) {
267 $return .= $techs[$i]->getRealName().'<br />';
276 // c-file-style: "bsd"