-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtambah_jadwal.php
177 lines (162 loc) · 6.42 KB
/
tambah_jadwal.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
<?php
include 'koneksi.php';
session_start();
if( !isset($_SESSION['username']) ){
echo '<script>alert("Silahkan login terlebih dahulu");</script>';
echo '<script>window.location="login.php";</script>';
}
if (isset($_POST['simpan'])){
$jam = $_POST['jam'];
$sound = $_POST['sound'];
$nama = $_POST['nama'];
$haritetap = $_POST['haritetap'];
$query = mysqli_query($conn, "INSERT INTO jadwal(jam, sound, hari, nama) VALUES('$jam', '$sound', '$haritetap', '$nama')");
if ($query) {
header("location:index.php");
}
}
$ishari = $_GET['ishari'];
function isHariIni($value){
global $hari;
if($hari == $value){
return "-- Hari ini --";
}
}
function valuehari($value){
if ($value == 1){
echo "Senin";
}elseif($value == 2){
echo "Selasa";
}elseif($value == 3){
echo "Rabu";
}elseif($value == 4){
echo "Kamis";
}elseif($value == 5){
echo "Jumat";
}elseif($value == 6){
echo "Sabtu";
}else{
echo "Salah";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Buat Jadwal Bel sekolah</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="color-scheme" content="light only" />
<link rel="stylesheet" href="styling/buatJadwalStyling.css" />
<link rel="canonical" href="index.html" />
<link
href="https://fonts.googleapis.com/css2?display=swap&family=Raleway:ital,wght@0,600;0,900;1,600;1,900&family=Source+Sans+Pro:ital,wght@0,300;1,300"
rel="stylesheet" type="text/css" />
<noscript>
<style>
body {
overflow: auto !important;
}
body:after {
display: none !important;
}
#main>.inner {
opacity: 1 !important;
}
#main {
opacity: 1 !important;
transform: none !important;
transition: none !important;
filter: none !important;
}
#main>.inner>section {
opacity: 1 !important;
transform: none !important;
transition: none !important;
filter: none !important;
}
</style>
</noscript>
</head>
<body class="is-loading">
<div id="wrapper">
<div id="main">
<div class="inner">
<section id="home-section">
<div id="columns01" class="container default">
<div class="wrapper">
<div class="inner">
<h1 id="text04">Buat jadwal</h1>
<p class="text05">
Silahkan isi form berikut untuk membuat jadwal baru
</p>
</div>
</div>
</div>
<form id="form01" method="post" action="tambah_jadwal.php">
<div class="inner">
<div class="field">
<input type="text" placeholder="<?= valuehari($ishari)?>" disabled="true" required />
<input type="hidden" name="haritetap" value="<?= $ishari?>" />
</div>
<div class="field">
<input type="text" name="nama" id="form01-name" placeholder="Nama Kegiatan"
maxlength="16" required />
</div>
<div class="field">
<p for="form01-waktu" class="text05">Waktu</p>
<input type="time" name="jam" id="form01-waktu" placeholder="Waktu" style="width: 200px"
required />
</div>
<div class="field">
<select name="sound" id="form01-sound" required>
<option value="">– Pilih Sound –</option>
<?php
$files = scandir("sounds");
$n=1;
foreach ($files as $namaFile) {
if($namaFile == '.' || $namaFile == '..'){
continue;
}
echo '<option value="'.$n.'">'.substr($namaFile,5, strlen($namaFile)-9).'</option>';
$n++;
}
?>
</select>
</div>
<div class="actions">
<button type="cancel" onclick="window.location='index.php';return false;">Batal</button>
<button type="submit" name="simpan">Buat Jadwal</button>
</div>
</div>
<input type="hidden" name="id" value="form01" />
</form>
<div id="columns02" class="container default">
<div class="wrapper">
<div class="inner">
<p id="text02">© Project TA. All rights reserved.</p>
</div>
</div>
</div>
</section>
<section id="done-section">
<div id="columns03" class="container default">
<div class="wrapper">
<div class="inner">
<h2 id="text01">Berhasil dibuat</h2>
<p id="text03">
Bel akan dibunyikan pada waktu yang telah ditentukan
</p>
<ul id="buttons01" class="buttons">
<li><a href="#home" class="button n01">Back</a></li>
</ul>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<script src="styling/butJadwalJS.js"></script>
</body>
</html>