-
Notifications
You must be signed in to change notification settings - Fork 1
/
updateEvent.php
648 lines (542 loc) · 27.2 KB
/
updateEvent.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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
<?php
include('private/conn.php');
session_start();
if(isset($_SESSION["id"]))
{
$id=$_SESSION["id"];
}
$event_id=$_GET['eventid'];
error_reporting(0);
$can=$_GET['cancel'];
//echo $can;
$a=1;
if($can==$a){
//echo $event_id;
$sql1='DELETE from create_event where event_id=\''.$event_id.'\';';
//echo $sql1;
$sql_query1 = $db->get_results($sql1);
//$results1 =count($sql_query1);
echo '<script>location.href="index.php"</script>';
}
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>MSP| Schedule management</title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Bubbler+One|Tangerine" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
#res1{
width:80%;
background-color:#ffffff;
margin-left:30%;
}
#res{
padding:5px;
float:left;
width:15%;
height:35%;
list-style-type: none;
}
#navi{
background-color: #000000;
overflow:hidden;
list-style-type: none;
color:#ffffff;
margin:0;
padding: 0;
}
#navi1{
float:right;
padding: 15px;
}
#navi2{
color:#ffffff;
display:block;
text-decoration: none;
}
#navi1:hover{
background-color: #cc0000;
}
</style>
</head>
<body>
<div id="wrapper">
<?php include("template/top.php");?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-6">
<h1 class="page-header">Update Event</h1>
</div>
<div class="col-lg-6">
<button id="btn_submit" class="btn btn-lg btn-primary" style="float:right; margin-top:4%;" onClick="location.href='getlist.php?cancel=1&eventid=<?php echo $event_id;?>'">Cancel Event</button>
</div>
<!-- /.col-lg-12 -->
</div>
<div id="page-content">
<?php
$sql="select * from create_event where event_id='$event_id'";
$ans=$db->get_row($sql);
$sql1="select host_id from create_event where event_id='$event_id'";
$ans1=$db->get_row($sql1);
$host= $ans1->host_id;
if(strcmp($host,$id)==0)
{
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
You can Update the details
</div>
<div class="panel-body ">
<div class="row">
<div class="col-lg-6">
<div name="error" id="error">
</div>
<form role="form" method="POST" id="create_event_form" name="create_event_form" action="updateInDb.php?eventid=<?php echo $event_id;?>">
<div class="form-group">
<label>Event Name</label>
<input name="event_name" class="form-control" type="text" value="<?php echo $ans->title;?>" disabled>
</input>
</div>
<div class="form-group">
<label>Description</label>
<textarea name="description" class="form-control" type="text" rows="6" cols="4"><?php echo $ans->description;?></textarea>
</div>
<div class="form-group">
<label>Date</label>
<input name="event_date" id="d" class="form-control" type="date" data-provide="datepicker" value="<?php echo $ans->date;?>">
</div>
<div class="form-group">
<label>Start Time</label>
<div class="input-group clockpicker">
<input name="start_time" type="time" class="form-control" value="<?php echo $ans->start_time;?>">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="form-group">
<label>End Time</label>
<div class="input-group clockpicker">
<input name="end_time" type="time" class="form-control" value="<?php echo $ans->end_time;?>">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="form-group">
<label>Category</label>
<select name="category" class="form-control" <?php echo $ans->category;?>>
<?php
$result = $db->get_results("select * from event_category;");
foreach ($result as $value) {
?>
<option value="<?php echo $value->category_name; ?>"><?php echo $value->category_name; ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label>Venue</label>
<input name="venue" class="form-control" type="text" value="<?php echo $ans->venue;?>">
</div>
<!--KOMAL-->
<!--<input name="search_term" type="text" style="margin-left:25%;width:30%;height:5%;margin-top:8%;padding:5px;" >
<input name="search_button" type="submit" value="Search" style="height:5%;"> -->
<div class="text-center">
<button type="submit" id="btn_submit" class="btn btn-lg btn-primary">Update Button</button>
</div>
</form>
<div id="#res1">
<b>Select Ministry</b><br>
<form method="post" action="">
<input name="search_term" list="search_term" class="form-control" ><br>
<datalist id="search_term">
<option value="Ministry">
<option value="Department of Programme Implementation ">
<option value="National Sample Survey Organisation(NSSO)">
<option value="Central Statistical Organisation">
<option value="Field Operations Division (FOD)">
<option value="Survey Design and Research Division (SDRD) ">
<option value="National Accounts Division (NAD)">
<option value="Industrial Statistics Division (ISD)">
</datalist>
<input name="search_button" type="submit" value="Search" style="height:5%;">
</form>
</div>
</div>
<!-- /.col-lg-6 (nested) -->
<div class="col-lg-3"></div>
</div>
<!-- /.col-lg-6 (nested) -->
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
<?PHP // Search.php
}
else
{
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
You can Update the details
</div>
<div class="panel-body ">
<div class="row">
<div class="col-lg-6">
<div name="error" id="error">
</div>
<form role="form" method="POST" id="create_event_form" name="create_event_form" action="updateInDb.php?eventid=<?php echo $event_id;?>">
<div class="form-group">
<label>Event Name</label>
<input name="event_name" class="form-control" type="text" value="<?php echo $ans->title;?>" disabled>
</input>
</div>
<div class="form-group">
<label>Description</label>
<textarea name="description" class="form-control" type="text" rows="6" cols="4" disabled><?php echo $ans->description;?></textarea>
</div>
<div class="form-group">
<label>Date</label>
<input name="event_date" id="d" class="form-control" type="date" data-provide="datepicker" value="<?php echo $ans->date;?>" disabled>
</div>
<div class="form-group">
<label>Start Time</label>
<div class="input-group clockpicker">
<input name="start_time" type="time" class="form-control" value="<?php echo $ans->start_time;?>" disabled>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="form-group">
<label>End Time</label>
<div class="input-group clockpicker">
<input name="end_time" type="time" class="form-control" value="<?php echo $ans->end_time;?>" disabled>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="form-group">
<label>Category</label>
<select name="category" class="form-control" <?php echo $ans->category;?> disabled>
<?php
$result = $db->get_results("select * from event_category;");
foreach ($result as $value) {
?>
<option value="<?php echo $value->category_name; ?>"><?php echo $value->category_name; ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label>Venue</label>
<input name="venue" class="form-control" type="text" value="<?php echo $ans->venue;?>" disabled>
</div>
</div>
<!-- /.col-lg-6 (nested) -->
<div class="col-lg-3"></div>
</div>
<!-- /.col-lg-6 (nested) -->
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<?php
}
$results = 0;
$results1=0;
$sql_query = 0;
$results2=0;
$sql_query2 = 0;
$first_pos = 0;
$sql1='SELECT `Name` , `office_name` , minister_info.Minister_ID , `designation_name` FROM `minister_info` INNER JOIN `designation` on minister_info.Minister_ID = designation.Minister_ID INNER JOIN `ministryoffice` on designation.Office_ID = ministryoffice.office_id AND minister_info.Minister_ID in ( SELECT `guest_id` from `guests` where guest_id=minister_info.Minister_id and event_id=\''.$event_id.'\' );';
$sql_query1 = $db->get_results($sql1);
$results1 =count($sql_query1);
if($results1!=0 && strcmp($host,$id)==0 )
{
echo '<center>';
echo '<div class="row">';
echo '<div class="col-lg-12" >';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo '<h4><b>List Of Invitees</b></h4>';
echo '</div>';
echo '<div class="panel-body">';
echo '<div class="table-responsive">';
echo '<table class="table table-striped table-bordered table-hover">';
echo '<tr>';
echo '<th>Sr_no</th>';
echo '<th>Minister_ID</th>';
echo '<th>Minister_Name</th>';
echo '<th>Designation</th>';
echo '<th>Office_Name</th>';
echo '<th>Send_Updates</th>';
echo '</tr>';
$i = 1;
?>
<form style="padding-left:20px;" method="post" action="sendUpdate.php?eventid=<?php echo $event_id;?>">;
<?php foreach ( $sql_query1 as $j )
{
echo "<tr>";
echo "<td>",$i,"</td>";
echo "<td>",$j->Minister_ID,"</td>";
echo "<td>",$j->Name,"</td>";
echo "<td>",$j->designation_name,"</td>";
echo "<td>",$j->office_name,"</td>";
echo '<td><input type="checkbox" name="id[]" value="'.$j->Minister_ID.'"checked /></td>';
echo "</tr>";
$i = $i + 1;
}
//<button type="button" class="btn btn-default">Default</button>
echo '</table>';
//echo '<br>';
echo ' <button type="submit" class="btn btn-default">Send-Update</button>';
echo '</form>';
echo'</div>';
// <!-- /.table-responsive -->
echo '</div>';
//<!-- /.panel-body -->
echo '</div>';
//<!-- /.panel -->
echo '</div>';
echo '</center>';
}
else
{
echo '<center>';
echo '<div class="row">';
echo '<div class="col-lg-12" >';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo '<h4><b>List Of Invitees</b></h4>';
echo '</div>';
echo '<div class="panel-body">';
echo '<div class="table-responsive">';
echo '<table class="table table-striped table-bordered table-hover">';
echo '<tr>';
echo '<th>Sr_no</th>';
echo '<th>Minister_ID</th>';
echo '<th>Minister_Name</th>';
echo '<th>Designation</th>';
echo '<th>Office_Name</th>';
// echo '<th>Send_Updates</th>';
echo '</tr>';
$i = 1;
?>
<form style="padding-left:20px;" method="post" action="sendUpdate.php?eventid=<?php echo $event_id;?>">;
<?php foreach ( $sql_query1 as $j )
{
echo "<tr>";
echo "<td>",$i,"</td>";
echo "<td>",$j->Minister_ID,"</td>";
echo "<td>",$j->Name,"</td>";
echo "<td>",$j->designation_name,"</td>";
echo "<td>",$j->office_name,"</td>";
// echo '<td><input type="checkbox" name="id[]" value="'.$j->Minister_ID.'"checked /></td>';
echo "</tr>";
$i = $i + 1;
}
//<button type="button" class="btn btn-default">Default</button>
echo '</table>';
//echo '<br>';
//echo ' <button type="submit" class="btn btn-default">Send-Update</button>';
echo '</form>';
echo'</div>';
// <!-- /.table-responsive -->
echo '</div>';
//<!-- /.panel-body -->
echo '</div>';
//<!-- /.panel -->
echo '</div>';
echo '</center>';
}
if(isset($_POST['search_button']))
{
$search_term = $_POST['search_term'];
#echo $search_term;
try
{
$date_beg='SELECT create_event.start_time from `create_event` where event_id=\''.$event_id.'\';';
$s1=$db->get_row($date_beg);
//echo $s1->start_time;
$date_end='SELECT create_event.end_time from `create_event` where event_id=\''.$event_id.'\';';
$s2=$db->get_row($date_end);
//echo $s2->end_time;
$date='SELECT create_event.date from `create_event` where event_id=\''.$event_id.'\';';
$s3=$db->get_row($date);
//echo $s3->date;
$sql = 'SELECT `Name` , `office_name` , minister_info.Minister_ID , `designation_name` FROM `minister_info` INNER JOIN `designation` on minister_info.Minister_ID = designation.Minister_ID INNER JOIN `ministryoffice` on designation.Office_ID = ministryoffice.office_id WHERE `office_name` = \''.$search_term.'\' AND minister_info.Minister_ID not in ( SELECT `guest_id` from `guests` where guest_id=minister_info.Minister_id and event_id= \''.$event_id.'\') AND minister_info.Minister_ID not in(SELECT `guest_id` from `guests` as gi inner join `create_event` as ce on gi.event_id=ce.event_id where ce.date = \''.$s3->date.'\' AND ( ce.start_time between \''.$s1->start_time.'\' and \''.$s2->end_time.'\' ) AND ( ce.end_time between \''.$s1->start_time.'\' and \''.$s2->end_time.'\' ) );';
//echo $sql;
$sql_query = $db->get_results($sql);
$results =count($sql_query);
$sql2 = 'SELECT `Name` , `office_name` , minister_info.Minister_ID , `designation_name` FROM `minister_info` INNER JOIN `designation` on minister_info.Minister_ID = designation.Minister_ID INNER JOIN `ministryoffice` on designation.Office_ID = ministryoffice.office_id WHERE `office_name` = \''.$search_term.'\' AND minister_info.Minister_ID not in ( SELECT `guest_id` from `guests` where guest_id=minister_info.Minister_id and event_id= \''.$event_id.'\') AND minister_info.Minister_ID in(SELECT `guest_id` from `guests` as gi inner join `create_event` as ce on gi.event_id=ce.event_id where ce.date = \''.$s3->date.'\' AND ( ce.start_time between \''.$s1->start_time.'\' and \''.$s2->end_time.'\' ) AND ( ce.end_time between \''.$s1->start_time.'\' and \''.$s2->end_time.'\' ) );';
// echo $sql;
$sql_query2 = $db->get_results($sql2);
$results2 =count($sql_query2);
}
catch(Exception $e)
{
;
}
//calculating the search time
}
if($results != 0)
{
echo '<center>';
echo '<div class="row">';
echo '<div class="col-lg-12">';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
?>
<h4><b>List Of Officers who are available in <?PHP echo $search_term; ?></b></h4>
<?php
echo '</div>';
echo '<div class="panel-body">';
echo '<div class="table-responsive">';
echo '<table class="table table-striped table-bordered table-hover">';
echo '<tr>';
echo '<th>Sr_no</th>';
echo '<th>Minister_ID</th>';
echo '<th>Minister_Name</th>';
echo '<th>Designation</th>';
echo '<th>Office_Name</th>';
echo '<th>Invitee</th>';
echo '</tr>';
$i = 1;
//echo '<script>window.alert("'.$resultCheck.' row(s) fetched");</script>';
?>
<form style="padding-left:20px;" method="post" action="invitee.php?eventid=<?php echo $event_id?>">';
<?php
foreach ( $sql_query as $j )
{
echo "<tr>";
echo "<td>",$i,"</td>";
echo "<td>",$j->Minister_ID,"</td>";
echo "<td>",$j->Name,"</td>";
echo "<td>",$j->designation_name,"</td>";
echo "<td>",$j->office_name,"</td>";
echo '<td><input type="checkbox" name="id[]" value="'.$j->Minister_ID.'"/></td>';
echo "</tr>";
$i = $i + 1;
}
echo '</table>';
echo '<button type="submit" class="btn btn-default">Send Invitation</button>';
echo '</form>';
echo'</div>';
// <!-- /.table-responsive -->
echo '</div>';
//<!-- /.panel-body -->
echo '</div>';
//<!-- /.panel -->
echo '</div>';
echo '</center>';
}
//if nothing is found then displays a form and a message that there are nor results for the specified term
elseif($sql_query)
{
?>
<h1 style="text-align:center; font-family:'Tangerine', cursive;margin-top:4%;">Oops!!! There are no officers who are available in <?PHP echo $search_term; ?><br>or you might already sent the invitation!!</h1>
</div>
<?PHP
}
if($results2 != 0)
{
echo '<center>';
echo '<div class="row">';
echo '<div class="col-lg-12" >';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
?>
<h4><b>List Of Officers who are busy in <?PHP echo $search_term; ?></b></h4>
<?php
echo '</div>';
echo '<div class="panel-body">';
echo '<div class="table-responsive">';
echo '<table class="table table-striped table-bordered table-hover">';
echo '<tr>';
echo '<th>Sr_no</th>';
echo '<th>Minister_ID</th>';
echo '<th>Minister_Name</th>';
echo '<th>Designation</th>';
echo '<th>Office_Name</th>';
echo '<th>Invitee</th>';
echo '</tr>';
$i = 1;
//echo '<script>window.alert("'.$resultCheck.' row(s) fetched");</script>';
?>
<form style="padding-left:20px;" method="post" action="invitee.php?'eventid=<?php echo $event_id?>">
<?php foreach ( $sql_query2 as $j )
{
echo "<tr>";
echo "<td>",$i,"</td>";
echo "<td>",$j->Minister_ID,"</td>";
echo "<td>",$j->Name,"</td>";
echo "<td>",$j->designation_name,"</td>";
echo "<td>",$j->office_name,"</td>";
echo '<td><input type="checkbox" name="id[]" value="'.$j->Minister_ID.'"/></td>';
echo "</tr>";
$i = $i + 1;
}
echo '</table>';
echo '<button type ="submit" style="color:#fff; margin-left: 150px">SUBMIT</button>';
echo '</form>';
echo'</div>';
// <!-- /.table-responsive -->
echo '</div>';
//<!-- /.panel-body -->
echo '</div>';
//<!-- /.panel -->
echo '</div>';
echo '</center>';
}
//if nothing is found then displays a form and a message that there are nor results for the specified term
elseif($sql_query2)
{
?>
<h1 style="text-align:center; font-family:'Tangerine', cursive;margin-top:4%;">There are no officers who are busy in <?PHP echo $search_term; ?></h1>
</div>
<?PHP
}
?>
</div>
</div>
<!-- jQuery -->
<?php
include("template/bottomScripts.php");
?>
<script>
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true
});
});
</script>
</body>
</html>