forked from Bkoech/gbvis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
enter_data.php
executable file
·173 lines (140 loc) · 5.41 KB
/
enter_data.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
<?php
//TA:60:4
$page_title = "Enter Data | GBV";
$current_page = "home";
require_once 'includes/global.inc.php';
// check to see if they're logged in
if (isset ( $_SESSION ['logged_in'] )) {
// get the user object from the session
$user = unserialize ( $_SESSION ['user'] );
if( !($userTools->isAdmin($user->user_group))){
print " You do not have permission to access this page.";
return;
}
// include "includes/Dash_header.php";include "includes/topbar.php"; //TA:60:1
include "includes/Dash_header.php"; // TA:60:1
include "includes/topbar.php"; // TA:60:1
// TA:60:1
//$db = new DB ();
$sectors = $db->selectAllOrdered ( "sectors", "sector");
?>
<script type="text/javascript">
function validate(title, value){
if(value == undefined || value == ""){
alert("Please select " + title);
return false;
}
return true;
}
function enter_data(){
var sector_type_id = $( "#sector_type_id" ).val();
var data_entry_type = $( "#data_entry_type" ).val();
if(validate("sector", sector_type_id)){
if(data_entry_type == 'data_entry_manul'){
if(sector_type_id == '1'){
window.location.href = "Sectors/Judiciary";
}else if(sector_type_id == '2'){
window.location.href = "Sectors/Health";
}else if(sector_type_id == '3'){
window.location.href = "Sectors/Police";
}else if(sector_type_id == '4'){
window.location.href = "Sectors/Prosecution";
}else if(sector_type_id == '5'){
window.location.href = "Sectors/Education";
}else{
alert("You cannot be redirected to selected sector.");
}
}else if(data_entry_type == 'data_entry_excel'){
if(sector_type_id == '1'){
window.location.href = "Sectors/Judiciary/import_excel.php";
}else if(sector_type_id == '2'){
window.location.href = "Sectors/Health/import_excel.php";
}else if(sector_type_id == '3'){
window.location.href = "Sectors/Police/import_excel.php";
}else if(sector_type_id == '4'){
window.location.href = "Sectors/Prosecution/import_excel.php";
}else if(sector_type_id == '5'){
window.location.href = "Sectors/Education/import_excel.php";
}else{
alert("You cannot be redirected to selected sector.");
}
}else{
alert("You cannot be redirected to selected data entry type.");
}
}
}
</script>
<!-- TA:60:1 <div id="sidebar">
<div class="sidebar-nav">
<?php
// include "../includes/sidebar.php";
?>
</div>
</div> -->
<div id="main-content_with_side_bar">
<div id="content-body">
<!-- <center>
<h2 class="page-title">Welcome to the National Sexual Gender Violence
Information System (GBVIS)</h2>
</center>-->
<!-- TA:60:1 -->
<div class="profile-data" align="left">
<!-- TA:60:1 START -->
<br clear="all">
<table width="30%" border="0" align="left" cellspacing="10">
<tr>
<td><select id="sector_type_id" name="sector_type_id" class="gbvis_select" title="Select Sector" onchange="getReportTypesList();">
<?php
foreach ( $sectors as $urows ) {
$disable = " disabled ";
if($userTools->isAdmin($user->user_group) && $urows ['0'] === $user->sector){
$disable = "";
}
if(!$disable) {
echo "<option value='" . $urows ['0'] . "' " . $disable . " >" . ucfirst($urows ['1']) . "</option>";
}
}
?>
</select></td>
</tr>
<tr>
<td><br><select id="data_entry_type" name="data_entry_type" class="gbvis_select" title="Select Sector" onchange="getReportTypesList();">
<option value="data_entry_manul" selected>Manual data entry</option>
<option value="data_entry_excel">Excel upload</option>
</select></td>
</tr>
<tr>
<td><br><button type="button" class="submit_button"
onClick='enter_data();'>Enter data</button></td>
</tr>
</table>
<!-- TA:60:1 END -->
<!-- TA:60:1 <a href="stardard_reports.php" style="float:left; width:25%; height:100px; margin-right:15px; text-decoration:none;" title="Standard Reports" >
<p>Standard Reports</p> <p><img src="images/reports.jpeg" height="70" /></p>
</a>
<a href="analytical_reports.php" style="float:left; width:25%; height:100px; margin-right:15px; text-decoration:none;" >
<p>Analytical Reports</p><p><img src="images/analytical.jpeg" height="70" title="Analytical Reports" /></p>
</a>-->
<br clear="all"> <br clear="all">
<br clear="all">
<br clear="all">
<!-- Your MD5 encrypted password: <font color="white"><?php //echo $passwd; ?></font>-->
<br clear="all">
<br clear="all">
<br clear="all"> <br clear="all">
<br clear="all">
<br clear="all">
</div>
<br clear="all">
</center>
</div>
</div>
<?php
include "includes/footer.php";
}
else
{
//Redirect user back to login page if there is no valid session created
header("Location: login.php");
}
?>