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 * http://fusionforge.org
10 * This file is part of FusionForge.
12 * FusionForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with FusionForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once $gfcommon.'pm/ProjectGroup.class.php';
29 function pm_header($params) {
30 // XXX ogi: What to do with these?
31 global $group_id,$is_pm_page,$words,$group_project_id,$HTML,$order,$pg;
33 if (!forge_get_config('use_pm')) {
37 //required by site_project_header
38 $params['group']=$group_id;
39 $params['toptab']='pm';
41 //only projects can use the bug tracker, and only if they have it turned on
42 $project =& group_get_object($group_id);
43 if (!$project || !is_object($project)) {
47 if (!$project->usesPm()) {
48 exit_disabled('home');
51 site_project_header($params);
52 echo '<h1>' . $params['title']. '</h1>';
57 if ($group_project_id) {
58 $labels[] = (($pg) ? $pg->getName() .': ' : '') ._('Browse tasks');
59 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=browse';
60 if (session_loggedin()) {
61 $labels[] = _('Add task');
62 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=addtask';
64 if ($group_project_id) {
67 $gantt_url = "/pm/task.php?group_id=$group_id&group_project_id=$group_project_id&func=ganttpage";
68 $gantt_title = _('Gantt Chart');
69 $gantt_winopt = 'scrollbars=yes,resizable=yes,toolbar=no,height=' . $gantt_height . ',width=' . $gantt_width;
70 $labels[] = $gantt_title;
71 $links[] = $gantt_url . '" onclick="window.open(this.href, \'' . preg_replace('/\s/' , '_' , $gantt_title)
72 . '\', \'' . $gantt_winopt . '\'); return false;';
74 //upload/download as CSV files
75 // $labels[] = _('Download as CSV');
76 // $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=downloadcsv';
77 // $labels[] = _('Upload CSV');
78 // $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=uploadcsv';
80 // Import/Export using CSV files.
81 $labels[] = _('Import/Export CSV');
82 $links[] = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=csv';
84 if ($pg && is_object($pg) && forge_check_perm ('pm', $pg->getID(), 'manager')) {
85 $labels[] = _('Reporting');
86 $links[] = '/pm/reporting/?group_id='.$group_id;
87 $labels[] = _('Admin');
88 $links[] = '/pm/admin/?group_id='.$group_id.'&group_project_id='.$group_project_id.'&update_pg=1';
91 echo ($HTML->subMenu($labels,$links));
95 plugin_hook ("blocks", "tasks_".$pg->getName());
98 function pm_footer($params) {
99 site_project_footer($params);
102 class ProjectGroupHTML extends ProjectGroup {
104 function ProjectGroupHTML(&$Group, $group_project_id=false, $arr=false) {
105 if (!$this->ProjectGroup($Group,$group_project_id,$arr)) {
112 function statusBox($name='status_id',$checked='xyxy',$show_100=true,$text_100='None') {
113 return html_build_select_box($this->getStatuses(),$name,$checked,$show_100,$text_100);
116 function categoryBox($name='category_id',$checked='xzxz',$show_100=true,$text_100='None') {
117 return html_build_select_box($this->getCategories(),$name,$checked,$show_100,$text_100);
120 function groupProjectBox($name='group_project_id',$checked='xzxz',$show_100=true,$text_100='None') {
121 $res=db_query_params ('SELECT group_project_id,project_name
122 FROM project_group_list
124 array($this->Group->getID()));
125 return html_build_select_box($res,$name,$checked,$show_100,$text_100);
128 function percentCompleteBox($name='percent_complete',$selected=0) {
130 <select name="'.$name.'">';
132 <option value="0">'._('Not Started'). '</option>';
133 for ($i=5; $i<101; $i+=5) {
135 <option value="'.$i.'"';
137 echo ' selected="selected"';
139 echo '>'.$i.'%</option>';
145 function showMonthBox($name,$select_month=0) {
147 <select name="'.$name.'" size="1">';
160 '12'=>_('December'));
162 for ($i=1; $i<=count($monthlist); $i++) {
163 if ($i == $select_month) {
165 <option selected="selected" value="'.$i.'">'.$monthlist[$i].'</option>';
168 <option value="'.$i.'">'.$monthlist[$i].'</option>';
175 function showDayBox($name,$day=1) {
177 <select name="'.$name.'" size="1">';
178 for ($i=1; $i<=31; $i++) {
181 <option selected="selected" value="'.$i.'">'.$i.'</option>';
184 <option value="'.$i.'">'.$i.'</option>';
191 function showYearBox($name,$year=1) {
193 <select name="'.$name.'" size="1">';
194 for ($i=1999; $i<=2013; $i++) {
197 <option selected="selected" value="'.$i.'">'.$i.'</option>';
200 <option value="'.$i.'">'.$i.'</option>';
207 function showHourBox($name,$hour=1) {
210 <select name="'.$name.'" size="1">';
211 for ($i=0; $i<=23; $i++) {
214 <option selected="selected" value="'.$i.'">'.$i.'</option>';
217 <option value="'.$i.'">'.$i.'</option>';
224 function showMinuteBox($name,$minute=0) {
225 echo ' <select name="'.$name.'" size="1">';
226 for ($i=0; $i<=45; $i=$i+15) {
228 echo ' <option selected="selected" value="'.$i.'">'.$i.'</option>';
231 <option value="'.$i.'">'.$i.'</option>';
238 function renderAssigneeList($assignee_ids) {
239 $techs =& user_get_objects($assignee_ids);
240 for ($i=0; $i<count($techs); $i++) {
241 $return .= $techs[$i]->getRealName().'<br />';
250 // c-file-style: "bsd"