/
project_Edit.php
238 lines (220 loc) · 7.1 KB
/
project_Edit.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?php
/*
* Practical Agile Scrum tool
*
* Copyright 2013-2017, P.P. Labuschagne
* Released under the MIT license.
* https://github.com/paul-lab/practical-agile/blob/master/_Licence.txt
*
* Homepage:
* http://practicalagile.co.uk
* http://practicalagile.uk
*
*/
include 'include/header.inc.php';
echo '<div class="hidden" id="phpbread"><a href="project_List.php">My Projects</a>->';
echo Get_Project_Name($_REQUEST['PID']);
echo '</div>';
?>
<script>
$(function() {
document.title = 'Practical Agile: '+$("#phpbread").text().substring(13);
$("#breadcrumbs").html($("#phpbread").html());
if ($("#phpnavicons")){
$("#navicons").html($("#phpnavicons").html());
}
});
</script>
<?php
function print_Size_Type_Dropdown($current){
Global $DBConn;
$resultres=$DBConn->directsql('select * from size_type');
if($current < 1 ) $current=1;
$Start = '<select name="Project_Size_ID"><option value="' . $current . '">';
$end .= '';
foreach ($resultres as $result) {
$end .= '<option value="' . $result['ID'] . '">' . $result['ID'].' - ' .$result['Desc'] . '</option>';
if ($current == $result['ID'] + 0) {
$Start .= $current .' - '.$result['Desc'];
}
}
unset($resultres);
$Start .= '</option>';
$end .= '</select>';
$menu = $Start.$end;
return $menu;
}
function NextbacklogID($thisproject){
Global $DBConn;
$today = date_create(Date("Y-m-d"));
$today = date_format($today , 'Y-m-d');
$data=array(
'Points_Object_ID' => NextPointsObject($thisproject),
'Project_ID' => $thisproject,
'Start_Date' => $today,
'End_Date' =>'2299-12-31 23:59:59',
'Comment_Object_ID' => NextIterationCommentObject(),
'Name' => 'Backlog'
);
return ($DBConn->create('iteration',$data));
}
$showForm = true;
if (isset($_POST['saveUpdate'])){
$data=array(
'Name' => htmlentities($_REQUEST['Name']),
'Category' => htmlentities($_REQUEST['Category']),
'Desc' => htmlentities($_REQUEST['Desc']),
'Desc_1' => $_REQUEST['Desc_1'],
'As_A' => ((isset($_REQUEST['As_A'])) ? 1 : 0),
'Col_2' => $_REQUEST['Col_2'],
'Desc_2' => $_REQUEST['Desc_2'],
'Acceptance' => ((isset($_REQUEST['Acceptance'])) ? 1 : 0),
'Enable_Tasks' => ((isset($_REQUEST['Enable_Tasks'])) ? 1 : 0),
'Project_Size_ID' => $_REQUEST['Project_Size_ID'],
'Vel_Iter' => $_REQUEST['Vel_Iter']
);
if ($Usr['Admin_User']==1){
$data['Archived'] = ((isset($_REQUEST['Archived'])) ? 1 : 0);
}
if (empty($_REQUEST['PID'])){
$button_name = 'Add';
$data['Backlog_ID'] = 0;
$data['Archived'] = 0;
$result=$DBConn->create('project',$data);
}else{
$button_name = 'Save';
$whereClause = 'ID = '.($_REQUEST['PID']+ 0);
$result=$DBConn->update('project',$data,$whereClause);
auditit($_REQUEST['PID'],0,$_SESSION['Email'],'Project Updated','',$_REQUEST['Name']);
}
if ($result<>0) {
if (empty($_REQUEST['PID'])){
$thisproject = $result;
$RPBID = NextbacklogID($thisproject);
$RPPOBJ = NextPointsObject($thisproject);
$data=array(
'Backlog_ID' => $RPBID,
'Points_Object_ID' => $RPPOBJ
);
$whereClause = 'ID = '.$thisproject;
$result=$DBConn->update('project',$data,$whereClause);
$DBConn->directsql( 'INSERT INTO story_type (Project_ID, `Desc`, `Order` ) SELECT "'.$thisproject.'", `Desc`, `Order` FROM story_type WHERE Project_ID=1');
$DBConn->directsql( 'INSERT INTO story_status (Project_ID, `Desc`, `Order`, RGB, policy) SELECT "'.$thisproject.'", `Desc`, `Order`, RGB, Policy FROM story_status WHERE Project_ID=1');
// give admin user rights
$sql = 'INSERT INTO user_project (`Project_ID`, `User_ID`, `Readonly`) VALUES('.$thisproject.',1,0)';
$DBConn->directsql($sql);
auditit($_REQUEST['PID'],0,$_SESSION['Email'],'Add new project ','',$_REQUEST['Name']);
}else{
$thisproject = $_REQUEST['PID'];
}
Update_Project_Points($thisproject);
$showForm = false;
}else{
if($DBConn->error){
$error = 'The form failed to process correctly.'.'<br>'.$DBConn->error;
}else{
$showForm = false;
}
}
}
if (!empty($error)) echo '<div class="error">'.$error.'</div>';
if ($showForm) {
if (!empty($_REQUEST['PID'])){
$project_Row = $DBConn->directsql('SELECT * FROM project WHERE ID = '.$_REQUEST['PID']);
}else{
$project_Row = $DBConn->directsql('SELECT As_A, Desc_1, Col_2, Desc_2, Acceptance, Enable_Tasks, Vel_Iter FROM project WHERE ID = 1');
}
$project_Row=$project_Row[0];
echo '<form method="post" action="?">';
echo '<table align="center" cellpadding="6" cellspacing="0" border="0">';
?>
<tr>
<td>Category:</td>
<td>
<input type="text" title="Use category to group related projects in the 'My Projects' list" name="Category" value="<?=$project_Row['Category'];?>">
</td>
</tr>
<tr>
<td>Name:</td>
<td>
<input type="text" name="Name" value="<?=$project_Row['Name'];?>">
</td>
</tr>
<tr>
<td>Desc:</td>
<td>
<textarea cols="40" rows="5" wrap="soft" name="Desc"><?=$project_Row['Desc'];?></textarea>
</td>
</tr>
<tr>
<td>Col 1 Desc.:</td>
<td>
<input type="text" title="This is how you want to label the first large text area of a card eg Details, So That ..." name="Desc_1" value="<?=$project_Row['Desc_1'];?>">
</td>
</tr>
<tr>
<td>Enable As A:</td>
<td>
<input <?=$project_Row['As_A'] == 1 ? 'checked' : '';?> value="1" title="This will enable the role field for cards for this project." type="checkbox" name=" As_A">
</td>
</tr>
<tr>
<td>Enable Col 2:</td>
<td>
<input <?=$project_Row['Col_2'] == 1 ? 'checked' : '';?> value="1" title="enable a second text area for cards in this project. (I Need: possibly)"type="checkbox" name="Col_2">
</td>
</tr>
<tr>
<td>Col 2: Desc</td>
<td>
<input type="text" name="Desc_2" value="<?=$project_Row['Desc_2'];?>">
</td>
</tr>
<tr>
<td>Enable Acceptance Criteria:</td>
<td>
<input <?=$project_Row['Acceptance'] == 1 ? 'checked' : '';?> value="1" title="Enable that all important acceptance criteria section of a card" type="checkbox" name="Acceptance">
</td>
</tr>
<tr>
<td>Enable Story tasks (on Scrum Board):</td>
<td>
<input <?=$project_Row['Enable_Tasks'] == 1 ? 'checked' : '';?> value="1" type="checkbox" name="Enable_Tasks">
</td>
</tr>
<tr>
<td>Story Size Scale:</td>
<td>
<?=print_Size_Type_Dropdown($project_Row['Project_Size_ID']+0);?>
</td>
</tr>
<tr>
<td>Iterations for Velocity:</td>
<td>
<input type="text" size=2 title="Number of completed Iterations to use to calculate Project velocity" name="Vel_Iter" value="<?=$project_Row['Vel_Iter'];?>">
</td>
</tr>
<tr>
<td>Archived:</td>
<td>
<input <?=$project_Row['Archived'] == 1 ? 'checked' : '';?> value="1" title="Archived projects only appear to Global administrators" type="checkbox" name="Archived">
</td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="PID" value="<?=$_REQUEST['PID'] + 0;?>">
<?php
if(!$isReadonly){
echo '<input class="btn" type="submit" name="saveUpdate" value="Update">';
}
?>
</td>
</tr>
</table>
</form>
<?php
}else{
header("Location:project_List.php");
}
include 'include/footer.inc.php';
?>