forked from philippK-de/Collabtive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
managetasklist.php
175 lines (158 loc) · 5.79 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
<?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();
$action = getArrayVal($_GET, "action");
$id = getArrayVal($_GET, "id");
$tlid = getArrayVal($_GET, "tlid");
$mode = getArrayVal($_GET, "mode");
$name = getArrayVal($_POST, "name");
$desc = getArrayVal($_POST, "desc");
$access = getArrayVal($_POST, "email");
$milestone = getArrayVal($_POST, "milestone");
$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, $name, $desc, 0, $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);
$mile_id = $tasklist["milestone"];
$m = $objmilestone->getMilestone($mile_id);
$tasklist["milestonename"] = $m["name"];
$milestones = $objmilestone->getAllProjectMilestones($id, 10000);
$project = array();
$project['ID'] = $id;
$myproject = (object) new project();
$pro = $myproject->getProject($id);
$projectname = $pro["name"];
$title = $langfile["edittasklist"];
$template->assign("title", $title);
$template->assign("projectname", $projectname);
$template->assign("showhead", 1);
$template->assign("milestones", $milestones);
$template->assign("tasklist", $tasklist);
$template->assign("project", $project);
$template->display("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, $name, $desc, $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");
}
?>