Menu

[r8]: / projects / exportproject.php  Maximize  Restore  History

Download this file

97 lines (76 with data), 4.2 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
<?php
#Application name: PhpCollab
#Status page: 0
#Path by root: ../projects/exportproject.php
$export = "true";
$checkSession = "false";
include_once('../includes/library.php');
require("../includes/phpmyadmin/defines.lib.php");
function which_crlf()
{
$the_crlf = "\n";
// The 'USR_OS' constant is defined in "./libraries/defines.lib.php"
// Win case
if (USR_OS == 'Win') {
$the_crlf = "\r\n";
}
// Mac case
else if (USR_OS == 'Mac') {
$the_crlf = "\r";
}
// Others
else {
$the_crlf = "\n";
}
return $the_crlf;
}
@set_time_limit(600);
$crlf = which_crlf();
/**
* Send headers depending on whether the user choosen to download a dump file
* or not
*/
$tmpquery = "WHERE pro.id = '$id'";
$projectDetail = new request();
$projectDetail->openProjects($tmpquery);
if ($projectDetail->pro_org_id[0] == "1") {
$projectDetail->pro_org_name[0] = $strings["none"];
}
$idStatus = $projectDetail->pro_status[0];
$idPriority = $projectDetail->pro_priority[0];
$dump_buffer .= $strings["project"].$crlf;
$dump_buffer .= "\"".$strings["name"]."\";\"".$strings["description"]."\";\"".$strings["owner"]."\";\"".$strings["priority"]."\";\"".$strings["status"]."\";\"".$strings["created"]."\";\"".$strings["organization"]."\"".$crlf;
$dump_buffer .= "\"".$projectDetail->pro_name[0]."\";\"".$projectDetail->pro_description[0]."\";\"".$projectDetail->pro_mem_login[0]."\";\"".$priority[$idPriority]."\";\"".$status[$idStatus]."\";\"".createDate($projectDetail->pro_created[0],$timezoneSession)."\";\"".$projectDetail->pro_org_name[0]."\"".$crlf.$crlf;
$tmpquery = "WHERE tas.project = '$id'";
$listTasks = new request();
$listTasks->openTasks($tmpquery);
$comptListTasks = count($listTasks->tas_id);
if ($comptListTasks != "0") {
$dump_buffer .= $strings["tasks"].$crlf;
$dump_buffer .= "\"".$strings["name"]."\";\"".$strings["description"]."\";\"".$strings["owner"]."\";\"".$strings["priority"]."\";\"".$strings["status"]."\";\"".$strings["created"]."\";\"".$strings["start_date"]."\";\"".$strings["due_date"]."\";\"".$strings["complete_date"]."\";\"".$strings["completion"]."\";\"".$strings["scope_creep"]."\";\"".$strings["estimated_time"]."\";\"".$strings["actual_time"]."\";\"".$strings["published"]."\";\"".$strings["comments"]."\";\"".$strings["assigned"]."\";\"".$strings["assigned_to"]."\"".$crlf;
for ($i=0;$i<$comptListTasks;$i++) {
if ($listTasks->tas_assigned_to[$i] == "0") {
$listTasks->tas_mem_login[$i] = $strings["unassigned"];
}
$idStatus = $listTasks->tas_status[$i];
$idPriority = $listTasks->tas_priority[$i];
$idPublish = $listTasks->tas_published[$i];
$complValue = ($listTasks->tas_completion[$i]>0) ? $listTasks->tas_completion[$i]."0 %": $listTasks->tas_completion[$i]." %";
if ($listTasks->tas_complete_date[$i] != "" && $listTasks->tas_complete_date[$i] != "--" && $listTasks->tas_due_date[$i] != "--") {
$diff = diff_date($listTasks->tas_complete_date[$i],$listTasks->tas_due_date[$i]);
}
$dump_buffer .= "\"".$listTasks->tas_name[$i]."\";\"".$listTasks->tas_description[$i]."\";\"".$listTasks->tas_mem2_login[$i]."\";\"".$priority[$idPriority]."\";\"".$status[$idStatus]."\";\"".createDate($listTasks->tas_created[$i],$timezoneSession)."\";\"".$listTasks->tas_start_date[$i]."\";\"".$listTasks->tas_due_date[$i]."\";\"".$listTasks->tas_complete_date[$i]."\";\"".$complValue."\";\"$diff\";\"".$listTasks->tas_estimated_time[$i]."\";\"".$listTasks->tas_actual_time[$i]."\";\"".$statusPublish[$idPublish]."\";\"".$listTasks->tas_comments[$i]."\";\"".$listTasks->tas_assigned[$i]."\";\"".$listTasks->tas_mem_login[$i]."\"".$crlf;
}
}
$filename = $strings["project"].$projectDetail->pro_id[0];
$ext = 'csv';
$mime_type = 'text/x-csv';
// Send headers
header('Content-Type: ' . $mime_type);
// lem9: we need "inline" instead of "attachment" for IE 5.5
$content_disp = (USR_BROWSER_AGENT == 'IE') ? 'inline' : 'attachment';
header('Content-Disposition: ' . $content_disp . '; filename="' . $filename . '.' . $ext . '"');
header('Pragma: no-cache');
header('Expires: 0');
echo $dump_buffer;
?>
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.