-
Notifications
You must be signed in to change notification settings - Fork 0
/
cases.php
388 lines (333 loc) · 11.8 KB
/
cases.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/navigation_bar.css">
<link rel="stylesheet" href="css/side-nav.css">
<link rel="stylesheet" href="css/cases.css">
<link rel="stylesheet" href="temp.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="js/search.js"></script>
<script>
$(document).ready(function(){
$("#vote").click(function(){
});
$(".collapse1").click(function(){
//$(".content1").slideToggle("slow");
var coll= $('.collapse1');
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
$("#checked").click(function(){
var element = this.nextElementSibling;
if (document.getElementById('checked').checked) {
element.style.display = "block";
} else {
element.style.display = "none";
}
});
$(".add").click(function(){
$(this).text(function(i,text){
return text === "Cancel" ? "Add Cases" : "Cancel";
})
$("#display").toggle();
});
});
function fun1()
{
var x = document.getElementById("voting");
var y = document.getElementById("result");
x.style.display = "block";
y.style.display = "none";
}
function fun2()
{
var x = document.getElementById("voting");
var y = document.getElementById("result");
x.style.display = "none";
y.style.display = "block";
}
var coll = document.getElementsByClassName("collapse");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
</script>
</head>
<body style="background-color:#efefef">
<?php require_once('sidebar.php');
require_once('classes/connection.php');
require_once('classes/cases_code.php');
require_once('classes/cases_post.php');
session_start();
if(!isset($_SESSION['username']))
{
header("location:login/index.php");
}
$username = $_SESSION['username'];
$obj = new Cases();
$pid = $obj->getPid($username);
$mycase = $obj->viewMycases($pid[0][0]);
// $viewcase = $obj->viewCases();
?>
<div class="w3-main" style="margin-left:200px">
<?php
require_once("classes/header.php");
?>
<div class="bground" >
<!-- <br/><br/><br/> -->
<!-- <table> -->
<!-- <tr> -->
<!-- <td> -->
<div class="row">
<div class="col-md-2"></div>
<div class="col-xs-5">
<div class="circle " style="margin-top:80px;" onclick="scrollwin(0, 500);fun1();" id="vote">
<img src="user.png" style="width:40%; margin-left:70px; margin-top:50px;"/>
<h4 style="color:white; text-align:center;"> MY CASES</h4>
</div>
</div>
<!-- </td> -->
<!-- <td> -->
<div class="col-xs-5">
<div class="circle " style=" margin-top:80px;" onclick="scrollwin(0, 500);fun2();">
<img src="view.png" alt="" style="width:40%; margin-left:70px; margin-top:50px;" id="rslt"/>
<h4 style="color:white; text-align:center;"> VIEW CASES </h4>
</div>
</div>
<!-- </td> -->
<!-- </tr> -->
<!-- </table> -->
</div>
</div>
<br/><br/>
<div id="voting" style="padding-bottom:500px;">
<!-- add cases -->
<div class="bgcolour">
<button class="add" value="Add case"> Add Case </button>
<!-- <button class="add" style="display:none;"> Cancel </button> -->
</div>
<div class="bgcolour" id="display" style="display:none;">
<div class="card_view-body">
<form action="cases.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo $pid[0][0]?>"/>
<label> <b>Title:</b></label><input name="title" type="text" placeholder=""><br/><br/>
<label> Date: </label><input name="date" type="date">
<label> Time: </label><input name="time" type="time"><br/><br/>
<label>Visibility: </label>
<select name="visible">
<option value="" disabled selected> visibility to other users </option>
<option value="1"> visible to all </option>
<option value="0"> visible to you only </option>
</select>
<br/><br/>
<label> Entre Case details: </label> <div> <textarea name="case" rows="5" cols="80" ></textarea></div><br/>
<input type="checkbox" id="checked" > Contains judgement?
<textarea name="judgement" rows="5" cols="80" placeholder="Enter judgement..." style="display:none;"></textarea>
<br/><br/>
<button name="add" > Add </button>
</div>
<!-- <div class="card_view-footer">
<p> this is the footer part of the content</p>
</div> -->
</form>
</div>
<!-- view my cases -->
<?php
foreach($mycase as $case){
echo "<form action=\"cases.php\" method=\"post\" enctype=\"multipart/form-data\">";
echo "<div class=\"card_view2\">";
echo "<div class=\"card_view-header\" >";
echo"<input type=\"hidden\" name=\"id\" value=\"".$case[0]."\"/>";
echo "<label class=\"".$case[0]."\" style=\" font-size:20px;text-transform:uppercase; \"> <b>".$case[1]."</b></label>";
echo "<input style=\"display:none;\" name=\"title\" type=\"text\" class=\"1".$case[0]."\" value=\"".$case[1]."\">";
echo"</div>";
echo"<div class=\"card_view-body\">";
echo"<label class=\"".$case[0]."\" name=\"date\" style=\"float:right;\"> ".$case[6]."</label> <br/>";
echo"<label name=\"time\" style=\"float:right; margin-left:5px;\">".$case[7]." </label>";
echo"<br/>";
echo"<label class=\"".$case[0]."\"><p> ".$case[4]." </p></label>";
echo"<textarea class=\"1".$case[0]."\" name=\"case\" rows=\"5\" cols=\"8\" type=\"text\" style=\"display:none;\" > ".$case[4]." </textarea>";
echo"<hr>";
echo"<label class=\"".$case[0]." \"><p><b>".$case[5]."</b></p></label>";
echo"<textarea class=\"1".$case[0]."\" rows=\"5\" name=\"judgement\" cols=\"8\" type=\"text\" style=\"display:none;\" >".$case[5]."</textarea>";
echo"</div>";
echo"<div class=\"card_view-footer\">";
echo"<button onclick=\"return edit_btn(".$case[0].") \"> Edit </button>
<button name=\"update\" id=\"u".$case[0]."\" style=\"display:none;\" onclick=\"btn_update(".$case[0]."); \"> Update </button>
<button id=\"c".$case[0]."\" style=\"display:none;\" onclick=\"return btn_cancel(".$case[0].")\"> Cancel </button>";
echo"<button name=\"delete\" onclick=\"return bnt_del(".$case[0].")\" class=\" d".$case[0]." \"> Delete</button>";
echo"</div>";
echo"</div>";
echo "</form>";
}
?>
<!-- - //view my cases - -->
<!-- end of my cases -->
</div>
<div id="result" style="display:none;">
<!-- - search panel - -->
<div>
<form action="" method='post' enctype='multipart/form-data'>
<div class="container" style="width:100%">
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<div class="input-group">
<div class="input-group-btn search-panel">
<button type="button" class="btn btn-default dropdown-toggle" style="width:70px; height:35px;" data-toggle="dropdown">
<span id="search_concept">Title</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#Date">Date</a></li>
<li><a id='dft' href="#Title">Title</a></li>
<li><a href="#News">cases</a></li>
<!-- <li><a href="#all"> All </a></li> -->
<!-- <li class="divider"></li> -->
<!-- <li><a href="#all">Anything</a></li> -->
</ul>
</div>
<input type="hidden" name="search_param" value="all" id="search_param"> <br/><br/>
<input type="text" class="form-control smallbar" id="sbar" name="x" placeholder="Search term...">
<input style=" width:50% !important;" type="date" class="form-control smallbar" id='from' name="fromd" placeholder="From">
<input style=" width:50% !important;" type="date" class="form-control smallbar" id='to' name="tod" placeholder="To">
<span class="input-group-btn">
<button class="btn btn-default" style="width:70px; height:35px;" id="sbtn" name='search' type="submit"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- - view cases - -->
<?php
foreach($result as $cases){
echo"<div class=\"card_view2\">
<div class=\"card_view-header capitals\" >
<label style=\"font-size:20px;\" > <b> ".$cases[1]." </b></label>
</div>
<div class=\"card_view-body\">
<label name=\"date\" style=\"float:right;\"> ".$cases[6]."</label> <br/>
<label name=\"time\" style=\"float:right; margin-left:5px;\"> ".$cases[7]." </label>
<br/>
<label><p>".$cases[4]."</p></label>
<hr>
<label><p> ".$cases[5]." </p></label>
</div>
</div>";
}
?>
</div>
<?php
require_once('footer.php');
?>
</div>
</div>
<script>
function w3_open() {
document.getElementById("mySidebar").style.display = "block";
}
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
}
function edit_btn(id){
$(".1"+id).show();
$("."+id).hide();
$("#u" + id).show();
$("#c" + id).show();
return false;
}
function btn_cancel(cid){
if(confirm("discard changes"))
{
$(".1"+cid).hide();
$("."+cid).show();
$("#u"+cid).hide();
$("#c"+cid).hide();
}else{
return false;
}
return false;
}
function btn_update(uid){
$(".1"+uid).hide();
$("."+uid).show();
$("#u"+uid).hide();
$("#c"+uid).hide();
}
function btn_del(did){
// $(".1"+uid).hide();
if(confirm("Delete Case")){
$("."+uid).show();
$("#u"+uid).hide();
$("#c"+uid).hide();
return true;
}
else
{
return false;
}
}
function scrollwin(x,y){
window.scrollBy(x,y);
}
$(document).ready(function(){
$("#vote").click(function(){
S("#voting").show();
$("#result").hide();
});
$("#rslt").click(function(){
S("#result").show();
$("#voting").hide();
});
$(".btn_edit").click(function(){
$(".txt").show();
$(".lbl").hide();
$("#update").show();
$("#cancel").show();
});
$("#update").click(function(){
$(".txt").hide();
$(".lbl").show();
$("#update").hide();
$("#cancel").hide();
});
$("#cancel").click(function(){
if(confirm("discard changes"))
{
$(".txt").hide();
$(".lbl").show();
$("#update").hide();
$("#cancel").hide();
}else{
return false;
}
});
});
/*else{
x.style.display = "none";
y.style.display = "block";
}*/
/*if (x.style.display =="none") {
x.style.display = "block";
} else {
x.style.display = "none";
}*/
</script>
</body>
</html>