-
Notifications
You must be signed in to change notification settings - Fork 131
/
managetasklist.php
179 lines (154 loc) · 5.82 KB
/
managetasklist.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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
include("init.php");
if (!isset($_SESSION["userid"])) {
$template->assign("loginerror", 0);
$template->display("login.tpl");
die();
}
$liste = (object) new tasklist();
$objmilestone = (object) new milestone();
//Get data from $_POST and $_GET filtered and sanitized by htmlpurifier
$cleanGet = cleanArray($_GET);
$cleanPost = cleanArray($_POST);
$action = getArrayVal($_GET, "action");
$id = getArrayVal($_GET, "id");
$tlid = getArrayVal($_GET, "tlid");
$mode = getArrayVal($_GET, "mode");
$project = array();
$project['ID'] = $id;
$classes = array("overview" => "overview",
"msgs" => "msgs",
"tasks" => "tasks_active",
"miles" => "miles",
"files" => "files",
"users" => "users",
"tracker" => "tracking"
);
$template->assign("classes", $classes);
if (!chkproject($userid, $id)) {
$errtxt = $langfile["notyourproject"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "$errtxt<br>$noperm");
$template->assign("mode", "error");
$template->display("error.tpl");
die();
}
if ($action == "addform") {
$milestones = $objmilestone->getAllProjectMilestones($id, 10000);
$title = $langfile['addtasklist'];
$template->assign("title", $title);
$template->assign("milestones", $milestones);
$template->assign("projectid", $project);
$template->display("addtasklist.tpl");
} elseif ($action == "add") {
if ($liste->add_liste($id, $cleanPost["name"], $cleanPost["desc"], 0, $cleanPost["milestone"])) {
$loc = $url . "managetask.php?action=showproject&id=$id&mode=listadded";
header("Location: $loc");
} else {
$template->assign("addliste", 0);
}
}
if ($action == "editform") {
if (!$userpermissions["tasks"]["edit"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
$template->display("error.tpl");
die();
}
$tasklist = $liste->getTasklist($tlid);
$milestone = $objmilestone->getMilestone($tasklist["milestone"]);
$tasklist["milestonename"] = $milestone["name"];
$milestones = $objmilestone->getAllProjectMilestones($id, 10000);
$project = array();
$project["ID"] = $id;
$projectObj = (object) new project();
$projectDetails = $projectObj->getProject($id);
$template->assign("title", $langfile["edittasklist"]);
$template->assign("projectname", $projectDetails["name"]);
$template->assign("showhead", 1);
$template->assign("milestones", $milestones);
$template->assign("tasklist", $tasklist);
$template->assign("project", $project);
$template->display("forms/edittasklist.tpl");
} elseif ($action == "edit") {
if (!$userpermissions["tasks"]["edit"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
$template->display("error.tpl");
die();
}
if ($liste->edit_liste($tlid, $cleanPost["name"], $cleanPost["desc"], $cleanPost["milestone"])) {
$loc = $url . "managetasklist.php?action=showtasklist&id=$id&tlid=$tlid&mode=edited";
header("Location: $loc");
} else {
$template->assign("editliste", 0);
}
} elseif ($action == "del") {
if (!$userpermissions["tasks"]["del"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
$template->display("error.tpl");
die();
}
if ($liste->del_liste($tlid)) {
$loc = $url . "managetask.php?action=showproject&id=$id&mode=listdeleted";
header("Location: $loc");
} else {
$template->assign("delliste", 0);
}
} elseif ($action == "close") {
if (!$userpermissions["tasks"]["close"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
$template->display("error.tpl");
die();
}
if ($liste->close_liste($tlid)) {
$loc = $url . "managetask.php?action=showproject&id=$id&mode=listclosed";
header("Location: $loc");
} else {
$template->assign("closeliste", 0);
}
} elseif ($action == "open") {
if (!$userpermissions["tasks"]["edit"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
$template->display("error.tpl");
die();
}
if ($liste->open_liste($tlid)) {
$loc = $url . "managetask.php?action=showproject&id=$id&mode=listopened";
header("Location: $loc");
// echo "ok";
} else {
$template->assign("openliste", 0);
}
} elseif ($action == "showtasklist") {
$myproject = (object) new project();
$project_members = $myproject->getProjectMembers($id,$myproject->countMembers($id),false);
$pro = $myproject->getProject($id);
$projectname = $pro["name"];
$template->assign("projectname", $projectname);
$tasklist = $liste->getTasklist($tlid);
$tasks = $liste->getTasksFromList($tlid);
$tasklist["tasknum"] = count($tasks);
$donetasks = $liste->getTasksFromList($tlid, 0);
$tasklist["donetasknum"] = count($donetasks);
$milestones = $objmilestone->getAllProjectMilestones($id, 10000);
$template->assign("milestones", $milestones);
$title = $langfile['tasklist'];
$template->assign("title", $title);
$template->assign("classes", $classes);
$template->assign("tasklist", $tasklist);
$template->assign("assignable_users", $project_members);
$template->assign("tasks", $tasks);
$template->assign("donetasks", $donetasks);
$template->assign("project", $project);
$template->display("tasklist.tpl");
}
?>