-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprojectmanager.php
More file actions
141 lines (122 loc) · 5.56 KB
/
projectmanager.php
File metadata and controls
141 lines (122 loc) · 5.56 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
<?php
define( 'ACTIVE_MENU', 'proj');
include_once 'core/header.php';
include_once 'core/logic/projectDA.php';
include_once 'core/logic/permissionDA.php';
include_once 'core/logic/taskpropDA.php';
include_once 'core/logic/componentDA.php';
$projDA = new ProjectDA();
$permDA = new PermissionDA();
$taskpropDA = new TaskpropDA();
$componentDA = new ComponentDA();
$selectedProject = null;
$alerts = "";
$edited = false;
if (isset($_GET["p"])) {
$selectedProject = $projDA->getProject($_GET["p"]);
}
if (!isset($selectedProject)) {
$permDA->echoPermissionDeniedAndDie();
}
if (!$permDA->isAdminOnProjectAllowed($selectedProject["id"])) {
$permDA->echoPermissionDeniedAndDie();
}
// General Settings
if (isset($_POST["general"])) {
$projDA->updateGeneral($selectedProject["id"], $_POST["editProjectname"], $_POST["editDescription"], "1.0");
$alerts = $alerts . '<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Successfull</strong> changed General Settings </div>';
$edited = true;
}
// New Component
if (isset($_POST["newComponent"])) {
$componentDA->createComponent($_POST["componentname"],"" , $selectedProject["id"]);
$alerts = $alerts . '<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Successfull</strong> create Component '.$_POST["componentname"].' </div>';
$edited = true;
}
// Update Componentname
if (isset($_POST["componentID"])) {
$componentDA->updateName($_POST["componentID"], $_POST["componentname"], $selectedProject["id"]);
$alerts = $alerts . '<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Successfull</strong> update Component '.$_POST["componentname"].' </div>';
$edited = true;
}
// Delete (just deactivate) Component
if (isset($_POST["deleteComponent"])) {
$componentDA->deactivateComponent($_POST["deleteComponent"], $selectedProject["id"]);
$alerts = $alerts . '<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Successfull</strong> deactivate Component</div>';
$edited = true;
}
if ($edited) {
$selectedProject = $projDA->getProject($_GET["p"]);
}
?>
<div id="main">
<ol class="breadcrumb">
<li><a href="index.php">Home</a></li>
<li><a href="project.php?p=<?php echo $selectedProject["id"]; ?>">Project <?php echo $selectedProject["name"]; ?></a></li>
<li class="active">Project Settings</li>
</ol>
<?php echo $alerts; ?>
<h1><?php echo $selectedProject["name"];?> Projectmanager</h1>
<p class="text-muted"><em>Created by <?php $user = $userDA->getUser($selectedProject["meta_creatorID"]); echo $user["prename"] . " " . $user["surname"]; ?>
(<?php echo $selectedProject["meta_createDate"]; ?>)</em></p>
<h2 class="subtitle"><i class="fa fa-angle-double-right"></i> General</h2>
<form action="?p=<?php echo $selectedProject["id"]; ?>" method="post">
<input type="hidden" name="general" value="true" />
<table class="table userEditTable">
<tr>
<th>Projectname:</th>
<td><input type="text" class="form-control" name="editProjectname"
value="<?php echo $selectedProject["name"];?>"></td>
</tr>
<tr>
<th>Description:</th>
<td><textarea name="editDescription" class="form-control" id="desc"
onkeydown="resizeTextarea('desc')"><?php echo $selectedProject["description"] ?></textarea></td>
</tr>
</table>
<script type="text/javascript">
resizeTextarea('desc');
</script>
<button type="submit" class="btn btn-primary">Save Changes</button>
</form>
<h2 class="subtitle"><i class="fa fa-angle-double-right"></i> Components</h2>
<ul class="list-group">
<?php
$componentsOfTheProject = $componentDA->getComponents($selectedProject["id"]);
while ($oneComponent = $componentsOfTheProject->fetch_assoc()) {
echo
<li class="list-group-item">
<form action="?p='.$selectedProject["id"].'" method="post" style="display: inline;" >
<input type="text" class="form-control" name="componentname" value="'.$oneComponent["name"].'" style="width: 250px; float: left;" />
<input type="hidden" name="componentID" value="'.$oneComponent["id"].'" />
<button type="submit" class="btn btn-default" style="margin-left: 30px;"><i class="fa fa-check"></i></button>
</form>
<form action="?p='.$selectedProject["id"].'" method="post" style="display: inline" >
<input type="hidden" name="deleteComponent" value="'.$oneComponent["id"].'" />
<button type="submit" class="btn btn-danger" style="margin-left: 10px;"><i class="fa fa-trash-o"></i></button>
</form>
</li>';
}
?>
<li class="list-group-item">
<form action="?p=<?php echo $selectedProject["id"]; ?>" method="post">
<input type="hidden" name="newComponent" value="true" />
<input type="text" class="form-control" name="componentname" value="" style="width: 250px; float: left;" />
<button id="addcomponent" type="submit" class="btn btn-success" style="margin-left: 30px;" data-toggle="tooltip" data-placement="right" title="add a new component">
<i class="fa fa-plus"></i>
</button>
<script type="text/javascript">$('#addcomponent').tooltip();</script>
</form>
</li>
</ul>
</div>
<?php
include 'core/footer.php';