-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
146 lines (137 loc) · 10.1 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Link to my stylesheet -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href=" https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<title>Quiz[1]->API</title>
</head>
<body data-bs-theme="dark">
<div class="main py-4 d-flex justify-contents-center">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="card mb-2 text-primary-emphasis border-primary-subtle">
<div class="card-body rounded">
<h4 class="text-center text-uppercase bold contentT">View of mechanisms, partners, agencies,
OUs and start and end dates for each mechanism.
</h4>
</div>
</div>
<div class="card mt-2 border-primary-subtle">
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<div class="row">
<div class="col-12">
<div class="card shadow border-primary-subtle text-info-emphasis">
<div class="card-header">
<h4 class="card-title" style="text-transform:capitalize;">
<!-- Card Title contents here -->
Data
<a href="data_to_database.php" class="btn btn-info float-end">Add
To
Database</a>
</h4>
</div>
<div class="card-body p-2 text-danger-emphasis">
<?php
session_start();
include('message.php');
?>
<div class="table-responsive">
<!-- Table contents here -->
<table id="example"
class="table table-bordered table-striped border-primary-subtle"
style="width:100%">
<!--Table header -->
<thead>
<tr>
<th class="text-danger-emphasis">Mechanism</th>
<th class="text-danger-emphasis">Code</th>
<th class="text-danger-emphasis">uid</th>
<th class="text-danger-emphasis">Partner</th>
<th class="text-danger-emphasis">primeid</th>
<th class="text-danger-emphasis">Agency</th>
<th class="text-danger-emphasis">ou</th>
<th class="text-danger-emphasis">startdate</th>
<th class="text-danger-emphasis">enddate</th>
</tr>
</thead>
<tbody>
<!--End of Table Heading-->
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://www.datim.org/api/sqlViews/fgUtV6e9YIX/data.json");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
$decs = json_decode($result, true);
if ($e = curl_error($curl)) {
echo $e;
} elseif (count($decs) != 0) {
foreach ($decs as $ma) : {
foreach ($ma as $m) : {
if (is_array($m)) {
foreach ((array)$m as $relate) : {
if (
isset($relate[0]) || isset($relate[1]) || isset($relate[2]) || isset($relate[3])
|| isset($relate[4]) || isset($relate[5]) || isset($relate[6]) || isset($relate[7])
|| isset($relate[8])
) {
?>
<tr>
<td class="text-primary-emphasis"><?= $relate[0] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[1] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[2] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[3] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[4] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[5] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[6] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[7] ?>
</td>
<td class="text-primary-emphasis"><?= $relate[8] ?>
</td>
</tr>
<!--End of Table Data-->
<?php
}
}
endforeach;
}
}
endforeach;
}
endforeach;
}
?>
<tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="src/index.js" type="text/javascript"></script>
</body>
</html>