Browse Source

first commit

master
panda 1 year ago
commit
db64db9875
3 changed files with 307 additions and 0 deletions
  1. 238
    0
      getmhs.php
  2. 51
    0
      index.html
  3. 18
    0
      koneksi.php

+ 238
- 0
getmhs.php View File

@@ -0,0 +1,238 @@
1
+<?php
2
+include "koneksi.php";
3
+
4
+
5
+
6
+$data = new \stdClass();
7
+
8
+$arr = array();
9
+$arr1 = array();
10
+
11
+$nim = $_POST['nim'];
12
+
13
+
14
+//-------------------------------------------Get Mahasiswa----------------------------------------------
15
+$sql = "select * from vw_info_mhs_perwalian where nim = '$nim'";
16
+$rs=odbc_exec($conn,$sql);
17
+
18
+while($myRow = odbc_fetch_array( $rs )){ 
19
+    $mahasiswa[] = $myRow;
20
+}
21
+
22
+$angkatan = $mahasiswa[0]['angkatan'];
23
+//------------------------------------------------------------------------------------------------------
24
+
25
+
26
+
27
+//-------------------------------------Cek Kampus----------------------------------------------------
28
+$sql = "select bol_jimbaran from mhs_mf where str_nim = '$nim'";
29
+$rs=odbc_exec($conn,$sql);
30
+
31
+while($myRow = odbc_fetch_array( $rs )){ 
32
+    $isJimbaran_a[] = $myRow;
33
+}
34
+
35
+$isJimbaran = $isJimbaran_a[0]['bol_jimbaran'];
36
+
37
+if ($isJimbaran == 1){
38
+    $max = 25;
39
+}else{
40
+    $max = 35;
41
+}
42
+//------------------------------------------------------------------------------------------------------
43
+
44
+
45
+
46
+//-------------------------------------Cek Kelas Malam----------------------------------------------------
47
+
48
+$sql = "select * from kelas_malam where str_t_ajaran ='2018/2019' and bol_semester = '1' and str_nim = '$nim'";
49
+$rs=odbc_exec($conn,$sql);
50
+
51
+if (odbc_fetch_array( $rs ) == null)
52
+    $ismalam = '0';
53
+else
54
+    $ismalam = '1';
55
+//------------------------------------------------------------------------------------------------------
56
+
57
+
58
+
59
+
60
+//-------------------------------------Cek karyawan----------------------------------------------------
61
+$sql = "select bol_sts_kelas  from mhs_mf where str_nim = '$nim'";
62
+$rs=odbc_exec($conn,$sql);
63
+
64
+while($myRow = odbc_fetch_array( $rs )){ 
65
+    $karyawan[] = $myRow;
66
+}
67
+
68
+if ($karyawan[0]['bol_sts_kelas'] == '1'){
69
+    $ismalam = '1';
70
+}else if ($karyawan[0]['bol_sts_kelas'] == '3'){
71
+    $ismalam = '1';
72
+}else{
73
+    $ismalam = '0';
74
+}
75
+//------------------------------------------------------------------------------------------------------
76
+
77
+
78
+
79
+
80
+//------------------------------------------Show Shcedules----------------------------------------------
81
+if ($angkatan == '2018'){
82
+    $sql = "select A.str_kd_perwalian,A.tgl_perwalian,A.str_jam_perwalian,str_angkatan,C.jml 
83
+    from perwalian_jadual A inner join SESI_2018_OFF C
84
+    on A.str_kd_perwalian = C.str_kd_perwalian
85
+    where A.str_thn_ajaran='2018/2019' and A.bol_semester='1' and  A.bol_malam = '$ismalam' and A.bol_jimbaran = '$isJimbaran' 
86
+    and jml <'$max' and A.str_angkatan = '$angkatan'";
87
+
88
+    $rs=odbc_exec($conn,$sql);
89
+    $count = 0;
90
+    while($myRow = odbc_fetch_array( $rs )){ 
91
+        array_push($arr, $myRow['jml']);
92
+        array_push($arr1, $myRow['str_kd_perwalian']);
93
+    }
94
+
95
+}else{
96
+    $sql = "select A.str_kd_perwalian,A.tgl_perwalian,A.str_jam_perwalian,str_angkatan,C.jml 
97
+    from perwalian_jadual A inner join SESI_2018_OFF C
98
+    on A.str_kd_perwalian = C.str_kd_perwalian
99
+    where A.str_thn_ajaran='2018/2019' and A.bol_semester='1' and  A.bol_malam = '$ismalam' and A.bol_jimbaran = '$isJimbaran' and A.tgl_perwalian = '2019/02/13'
100
+    and jml <='150' and (A.str_angkatan = '$angkatan' or A.str_angkatan = '9999')";
101
+
102
+    $rs=odbc_exec($conn,$sql);
103
+    $count = 0;
104
+    while($myRow = odbc_fetch_array( $rs )){ 
105
+        array_push($arr, $myRow['jml']);
106
+        array_push($arr1, $myRow['str_kd_perwalian']);
107
+    }
108
+}
109
+
110
+//------------------------------------------------------------------------------------------------------
111
+
112
+
113
+//------------------------------------------Selection Sort----------------------------------------------
114
+for($i=0; $i<count($arr)-1; $i++) {
115
+	$min = $i;
116
+	for($j=$i+1; $j<count($arr); $j++) {
117
+		if ($arr[$j]<$arr[$min]) {
118
+			$min = $j;
119
+		}
120
+    }
121
+    $backup_old_data_right_value = $arr[$min];
122
+	$arr[$min] = $arr[$i];
123
+    $arr[$i] = $backup_old_data_right_value;
124
+    
125
+    $backup_old_data_right_value = $arr1[$min];
126
+	$arr1[$min] = $arr1[$i];
127
+	$arr1[$i] = $backup_old_data_right_value;
128
+}
129
+//------------------------------------------------------------------------------------------------------
130
+
131
+//============================================================================================================
132
+//============================================================================================================
133
+//============================================================================================================
134
+//============================================================================================================
135
+
136
+//-------------------------------------------Cek Jadwal Kosong----------------------------------------------
137
+$sql = "select * from perwalian_mhs where str_nim = '$nim' and str_semester = (select dbo.xSinakGetSemesterMahasiswa2('$nim','2018/2019','1'))";
138
+$rs=odbc_exec($conn,$sql);
139
+
140
+if (odbc_fetch_array( $rs ) == null){
141
+    echo ("insert");
142
+
143
+    //-------------------------------------------Get Romawi----------------------------------------------
144
+    $sql = "select dbo.xSinakGetSemesterMahasiswa2('$nim','2018/2019','1') as semester_romawi";
145
+    $rs=odbc_exec($conn,$sql);
146
+
147
+    while($myRow = odbc_fetch_array( $rs )){ 
148
+        $romawi_a[] = $myRow;
149
+    }
150
+    
151
+    $romawi = $romawi_a[0]['semester_romawi'];
152
+    //---------------------------------------------------------------------------------------------------
153
+
154
+
155
+    //-------------------------------------------Get Bol Semester----------------------------------------
156
+    $sql = "select dbo.wGetBolSemester('$romawi') as bol_semester";
157
+    $rs=odbc_exec($conn,$sql);
158
+
159
+    while($myRow = odbc_fetch_array( $rs )){ 
160
+        $bol_semester_a[] = $myRow;
161
+    }
162
+    
163
+    $bol_semester = $bol_semester_a[0]['bol_semester'];
164
+    //---------------------------------------------------------------------------------------------------
165
+
166
+
167
+    //-------------------------------------------Get Semester--------------------------------------------
168
+    $sql = "select dbo.xSinakGetSemesterMahasiswa1('$nim','2018/2019','1') as semester";
169
+    $rs=odbc_exec($conn,$sql);
170
+
171
+    while($myRow = odbc_fetch_array( $rs )){ 
172
+        $semester_a[] = $myRow;
173
+    }
174
+    
175
+    $semester = $semester_a[0]['semester'];
176
+    //---------------------------------------------------------------------------------------------------
177
+   
178
+
179
+    //---------------------------------------------Insert-------------------------------------------------
180
+    $sql = "insert into perwalian_mhs (str_nim, str_thn_ajaran, str_semester, bol_semester, num_no_perwalian, str_angkatan, str_kd_smt, str_kd_perwalian, num_urut, bol_cetak, tgl_perwalian, str_jam_perwalian, str_kd_perwalian_history, str_token_perwalian)
181
+    VALUES ('$nim', '2018/2019', '$romawi', '$bol_semester','0', '$angkatan', '$semester', '$arr1[0]', '0', '0', '', '', '', '')";
182
+
183
+    if(odbc_exec($conn,$sql))
184
+        $data = 'ok';
185
+    else
186
+        $data = 'fail';
187
+}else{
188
+    echo ("update");
189
+    //-------------------------------------------Get Romawi----------------------------------------------
190
+    $sql = "select dbo.xSinakGetSemesterMahasiswa2('$nim','2018/2019','1') as semester_romawi";
191
+    $rs=odbc_exec($conn,$sql);
192
+
193
+    while($myRow = odbc_fetch_array( $rs )){ 
194
+        $romawi_a[] = $myRow;
195
+    }
196
+    
197
+    $romawi = $romawi_a[0]['semester_romawi'];
198
+    //---------------------------------------------------------------------------------------------------
199
+
200
+
201
+    //-------------------------------------------Get Bol Semester----------------------------------------
202
+    $sql = "select dbo.wGetBolSemester('$romawi') as bol_semester";
203
+    $rs=odbc_exec($conn,$sql);
204
+
205
+    while($myRow = odbc_fetch_array( $rs )){ 
206
+        $bol_semester_a[] = $myRow;
207
+    }
208
+    
209
+    $bol_semester = $bol_semester_a[0]['bol_semester'];
210
+    //---------------------------------------------------------------------------------------------------
211
+
212
+
213
+    //-------------------------------------------Get Semester--------------------------------------------
214
+    $sql = "select dbo.xSinakGetSemesterMahasiswa1('$nim','2018/2019','1') as semester";
215
+    $rs=odbc_exec($conn,$sql);
216
+
217
+    while($myRow = odbc_fetch_array( $rs )){ 
218
+        $semester_a[] = $myRow;
219
+    }
220
+    
221
+    $semester = $semester_a[0]['semester'];
222
+    //---------------------------------------------------------------------------------------------------
223
+
224
+    //--------------------------------------------Update-------------------------------------------------
225
+    $sql = "UPDATE perwalian_mhs
226
+    SET str_nim = '$nim', str_thn_ajaran = '2018/2019', str_semester = '$romawi', bol_semester = '$bol_semester', num_no_perwalian = '0', str_angkatan = '$angkatan', str_kd_smt = '$semester', str_kd_perwalian = '$arr1[0]', num_urut = '0', bol_cetak = '0',  tgl_perwalian = '', str_jam_perwalian='', str_kd_perwalian_history=''
227
+    where str_nim = '$nim' and str_semester = '$romawi'";
228
+
229
+    if(odbc_exec($conn,$sql))
230
+        $data = 'ok';
231
+    else
232
+        $data = 'fail';
233
+}
234
+
235
+header("location:http://192.168.137.21:8080/api/index.html");
236
+
237
+
238
+?>

+ 51
- 0
index.html View File

@@ -0,0 +1,51 @@
1
+<!DOCTYPE html>
2
+    <html>
3
+        <head>
4
+            <meta charset="utf-8">
5
+            <meta name="viewport" content="width=device-width, initial-scale=1">
6
+            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
7
+            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
8
+            <link rel="stylesheet" href="theme.css" type="text/css">
9
+            
10
+            <link rel="icon" href="images/dpaon_logo.ico">
11
+
12
+        </head>
13
+        <style>
14
+            .divider-medium {
15
+                height: 200px;
16
+            }
17
+            .divider-small {
18
+                height: 100px;
19
+            }
20
+        </style>
21
+        <body class="" style="background-position:right center;background-size:cover;background-repeat:no-repeat;">
22
+            <nav class="navbar navbar-expand-md bg-primary navbar-dark">
23
+                <div class="container">
24
+                    <a class="navbar-brand" href="dashboard.php">
25
+                        <b>&nbsp&nbspSISTEM PENJADWALAN PERWALIAN</b>
26
+                    </a>
27
+                </div>
28
+            </nav>
29
+            <div class="divider-small"></div>
30
+            <div class="p-3 align-self-center">
31
+                <h4 class="text-center p-3">Masukan NIM Untuk Memberi Jadwal</h4>
32
+                <div class="container">
33
+                    <div class="row">
34
+                        <div class="col-md-12">
35
+                            <div class="p-1">
36
+                                <form  method="post" action="/api/getmhs.php">
37
+                                    <div class="input-group mb-3">
38
+                                        <div class="input-group input-group-lg">
39
+                                            <input type="text" name="nim" value="" class="form-control" name="nim" placeholder="Ketikkan NIM Mahasiswa disini..." >
40
+                                            </div>
41
+                                        </div>
42
+                                        <br>
43
+                                        <button type="submit" class="btn btn-primary btn-block btn-md">submit</button>
44
+                                    </div>
45
+                                </form>
46
+                            </div>
47
+                        </div>
48
+                    </div>
49
+                </div>
50
+        </body>
51
+    </html>

+ 18
- 0
koneksi.php View File

@@ -0,0 +1,18 @@
1
+<?php
2
+// header('Access-Control-Allow-Origin: *');
3
+// header('Access-Control-Request-Method: POST');
4
+
5
+$server = "192.168.0.5";
6
+$user = "crosario";
7
+$password = "b4tl3f13ld@db";
8
+$database = "SINAK";
9
+
10
+
11
+// Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver - allows connection to SQL 7, 2000, 2005 and 2008
12
+$conn = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);
13
+
14
+// if ($connection)
15
+//     echo "mau";
16
+// else
17
+//     echo "tidak";
18
+?>

Loading…
Cancel
Save