Menu

[r10]: / projects_site / graphtasks.php  Maximize  Restore  History

Download this file

152 lines (130 with data), 5.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/*
** Application name: phpCollab
** Last Edit page: 04/12/2004
** Path by root: ../projects_site/graphtasks.php
** Authors: Ceam / Fullo
**
** =============================================================================
**
** phpCollab - Project Managment
**
** -----------------------------------------------------------------------------
** Please refer to license, copyright, and credits in README.TXT
**
** -----------------------------------------------------------------------------
** FILE: graphtasks.php
**
** DESC: Screen: render the calendar or project gantt graph for project_site
**
** HISTORY:
** 21/04/2005 - added the broadcast visualization
** 20/04/2005 - added the calendar view
** -----------------------------------------------------------------------------
** TO-DO:
**
**
** =============================================================================
*/
$checkSession = "true";
include("../includes/library.php");
include("../includes/jpgraph/jpgraph.php");
include("../includes/jpgraph/jpgraph_gantt.php");
$graph = new GanttGraph();
$graph->SetBox();
$graph->SetMarginColor("white");
$graph->SetColor("white");
$graph->title->SetFont(FF_FONT1);
$graph->SetColor("white");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT0);
$graph->scale->year->SetFont(FF_FONT1);
// case of calendar graph
if ($_GET['dateCalend'] != '')
{
$graph->title->Set($strings["calendar"]);
$graph->subtitle->Set($dateCalend);
$dateCalend = substr($dateCalend,0,7);
//add the published task to the graph
$tmpquery = "WHERE (tas.start_date LIKE '".$dateCalend."%' OR tas.due_date LIKE '".$dateCalend."%') AND tas.published = '0' AND tas.assigned_to = '$idSession' ORDER BY tas.due_date";
$listTasks = new request();
$listTasks->openTasks($tmpquery);
$comptListTasks = count($listTasks->tas_id);
for ($i=0;$i<$comptListTasks;$i++)
{
$listTasks->tas_name[$i] = str_replace('&quot;','"',$listTasks->tas_name[$i]);
$listTasks->tas_name[$i] = str_replace("&#39;","'",$listTasks->tas_name[$i]);
$progress = round($listTasks->tas_completion[$i]/10,2);
$printProgress = $listTasks->tas_completion[$i]*10;
$activity = new GanttBar($i,$listTasks->tas_name[$i],$listTasks->tas_start_date[$i],$listTasks->tas_due_date[$i]);
$activity->SetPattern(BAND_LDIAG,"yellow");
$activity->caption->Set($listTasks->tas_mem_login[$i]." (".$printProgress."%)");
$activity->SetFillColor("gray");
if ($listTasks->tas_priority[$i] == "4" || $listTasks->tas_priority[$i] == "5")
{
$activity->progress->SetPattern(BAND_SOLID,"#BB0000");
}
else
{
$activity->progress->SetPattern(BAND_SOLID,"#0000BB");
}
$activity->progress->Set($progress);
$graph->Add($activity);
}
$tmpquery = "WHERE cal.owner = '$idSession' OR cal.broadcast = '1' ";
$detailCalendar = new request();
$detailCalendar->openCalendar($tmpquery);
$comptDetailCalendar = count($detailCalendar->cal_id);
for ($j=0;$j < $comptDetailCalendar;$j++)
{
$detailCalendar->cal_subject[$j] = str_replace('&quot;','"',$detailCalendar->cal_subject[$j].'('.$detailCalendar->cal_location[$j].')');
$detailCalendar->cal_subject[$j] = str_replace("&#39;","'",$detailCalendar->cal_subject[$j]);
$activity = new GanttBar($i+$j,$detailCalendar->cal_subject[$j],$detailCalendar->cal_date_start[$j],$detailCalendar->cal_date_end[$j]);
$activity->SetPattern(BAND_LDIAG,"yellow");
$activity->caption->Set($detailCalendar->cal_mem_name[$j]);
$activity->SetFillColor("gray");
$activity->progress->SetPattern(BAND_SOLID,"#0000BB");
$activity->progress->Set($progress);
$graph->Add($activity);
}
}
elseif ($_GET['project'] != '')
{
// case of project graph
$graph->title->Set($strings["project"]." ".$projectDetail->pro_name[0]);
$graph->subtitle->Set("(".$strings["created"].": ".$projectDetail->pro_created[0].")");
$tmpquery = "WHERE pro.id = '".$project."'";
$projectDetail = new request();
$projectDetail->openProjects($tmpquery);
$projectDetail->pro_created[0] = createDate($projectDetail->pro_created[0],$timezoneSession);
$projectDetail->pro_name[0] = str_replace('&quot;','"',$projectDetail->pro_name[0]);
$projectDetail->pro_name[0] = str_replace("&#39;","'",$projectDetail->pro_name[0]);
$tmpquery = "WHERE tas.project = '".$project."' AND tas.start_date != '--' AND tas.due_date != '--' AND tas.published != '1' ORDER BY tas.due_date";
$listTasks = new request();
$listTasks->openTasks($tmpquery);
$comptListTasks = count($listTasks->tas_id);
for ($i=0;$i<$comptListTasks;$i++)
{
$listTasks->tas_name[$i] = str_replace('&quot;','"',$listTasks->tas_name[$i]);
$listTasks->tas_name[$i] = str_replace("&#39;","'",$listTasks->tas_name[$i]);
$progress = round($listTasks->tas_completion[$i]/10,2);
$printProgress = $listTasks->tas_completion[$i]*10;
$activity = new GanttBar($i,$listTasks->tas_name[$i],$listTasks->tas_start_date[$i],$listTasks->tas_due_date[$i]);
$activity->SetPattern(BAND_LDIAG,"yellow");
$activity->caption->Set($listTasks->tas_mem_login[$i]." (".$printProgress."%)");
$activity->SetFillColor("gray");
if ($listTasks->tas_priority[$i] == "4" || $listTasks->tas_priority[$i] == "5")
{
$activity->progress->SetPattern(BAND_SOLID,"#BB0000");
}
else
{
$activity->progress->SetPattern(BAND_SOLID,"#0000BB");
}
$activity->progress->Set($progress);
$graph->Add($activity);
}
}
$graph->Stroke();
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.