-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_vol_activity.php
executable file
·125 lines (119 loc) · 5.01 KB
/
add_vol_activity.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
<?php
include 'includes/header.php';
if(isset($_GET['rmid'])){
$rmid = $_GET['rmid'];
// remove 'stmo' from id
$rmid = substr($rmid,4);
$action="remove";
$aid = $_GET['aid'];
// add into an array
$data2 = get_api_data_post("https://apis.stmorg.in/activities/manage_activity_vol",array('action'=>$action,'aid'=>$aid,'volunteers'=>$rmid));
$data2 = json_decode($data2, true);
$data2 = $data2['data'];
if($data2['status']=='success'){
echo "<script>window.location.href='add_vol_activity?id=".$aid."';</script>";
}else{
echo "<script>window.location.href='add_vol_activity?id=".$aid."';</script>";
}
}
if(isset($_GET['id'])){
$id = $_GET['id'];
$url = "https://apis.stmorg.in/activities/activity_volunteers?id=".$id;
$data = get_api_data($url);
$data = json_decode($data, true);
$data = $data['data'];
}else{
echo "<script>window.location.href='volunteering_activities';</script>";
}
if(isset($_POST['action'])){
$data2 = get_api_data_post("https://apis.stmorg.in/activities/manage_activity_vol",$_POST);
$data2 = json_decode($data2, true);
print_r($data2);
$data2 = $data2['data'];
if($data2['status']=='success'){
echo "<script>window.location.href='add_vol_activity?id=".$id."';</script>";
}else{
echo "<script>window.location.href='add_vol_activity?id=".$id."';</script>";
}
}
?>
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="page-header">
<h3 class="page-title">
<span class="page-title-icon bg-gradient-danger text-white me-2">
<i class="mdi mdi-home"></i>
</span>
Select Activity
</h3>
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<!-- search bar -->
<li>
<form method="POST">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Id's"
aria-label="Recipient's username" name="volunteers"
aria-describedby="basic-addon2">
<input type="hidden" name="action" value="add">
<input type="hidden" name="aid" value="<?php echo $id; ?>">
<div class="input-group-append">
<button class="btn btn-sm btn-gradient-primary" type="submit">Add
Volunteers</button>
</div>
</div>
</div>
</form>
</li>
</ul>
</nav>
</div>
<!-- form -->
<div class="row">
<div class="col-12 grid-margin">
<div class="card">
<div class="card-body">
<h4 class="card-title">Attended Volunteers</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Mobile</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if(isset($data['status']) && $data['status']=='error'){
}else{
for($i=0; $i<count($data); $i++){
?>
<tr>
<td><?php echo $data[$i]['id']; ?></td>
<td><?php echo $data[$i]['name']; ?></td>
<td><?php echo $data[$i]['mobile']; ?></td>
<td>
<a href="add_vol_activity?rmid=<?php echo $data[$i]['id']; ?>&aid=<?php echo $id; ?>"
class="btn btn-gradient-info btn-sm">Remove</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<?php
include 'includes/footer.php';
?>