forked from philippK-de/Collabtive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mytasks.php
89 lines (75 loc) · 2.51 KB
/
mytasks.php
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
<?php
include("init.php");
if (!isset($_SESSION["userid"])) {
$template->assign("loginerror", 0);
$template->display("login.tpl");
die();
}
$action = getArrayVal($_GET, "action");
$project = new project();
if (!$action) {
$task = new task();
$myprojects = $project->getMyProjects($userid);
$milestone = new milestone();
$milestones = array();
$cou = 0;
$tasknum = 0;
$ltasksa = array();
$tlist = new tasklist();
$alltasks = array();
if (!empty($myprojects)) {
foreach($myprojects as $proj) {
$tasks = $task->getAllMyProjectTasks($proj["ID"], 10000);
$lists = $tlist->getProjectTasklists($proj["ID"], 1);
$donetasks = $task->getMyDoneProjectTasks($proj["ID"], 10000);
$myprojects[$cou]['tasks'] = $tasks;
$myprojects[$cou]['oldtasks'] = $donetasks;
$myprojects[$cou]['lists'] = $lists;
if (!empty($tasks)) {
$pcount = count($tasks);
} else {
$pcount = 0;
}
$myprojects[$cou]['tasknum'] = $pcount;
if (!empty($tasks)) {
$tcount = count($tasks);
$tasknum = $tasknum + $tcount;
array_push($alltasks, $tasks);
}
$cou = $cou + 1;
}
}
$etasks = reduceArray($alltasks);
$title = $langfile['mytasks'];
$template->assign("title", $title);
$template->assign("tasks", $etasks);
$template->assign("tasknum", count($etasks));
$template->assign("myprojects", $myprojects);
$template->display("mytasks.tpl");
} elseif ($action == "pdf") {
$pdf = new MYPDF("P", PDF_UNIT, "A4", true);
$pdf->setup($langfile["mytasks"], array(229, 235, 235));
$headers = array($langfile["title"], $langfile["project"], $langfile["daysleft"]);
$mtask = new task();
$msg = new message();
$myprojects = $project->getMyProjects($userid);
$messages = array();
$milestones = array();
$tasks = array();
if (!empty($myprojects)) {
foreach($myprojects as $proj) {
$task = $mtask->getAllMyProjectTasks($proj["ID"], 100);
if (!empty($task)) {
array_push($tasks, $task);
}
}
}
$etasks = reduceArray($tasks);
$fintasks = array();
foreach($etasks as $etask) {
array_push($fintasks, array($etask["title"], $etask["pname"], $etask["daysleft"]));
}
$pdf->table($headers, $fintasks);
$pdf->Output("my-tasks-$username.pdf", "D");
}
?>