-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlihattugas.php
165 lines (150 loc) · 7.25 KB
/
lihattugas.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
<?php
defined('APLIKASI') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$ac = dekripsi($ac);
echo $ac;
$tugas = mysqli_fetch_array(mysqli_query($koneksi, "select * from tugas where id_tugas='$ac'"))
?>
<div class='row'>
<div class='col-md-12'>
<div class='box box-solid'>
<div class='box-header with-border'>
<h3 class='box-title'><i class="fas fa-file-signature "></i> Detail Tugas Siswa</h3>
</div><!-- /.box-header -->
<div class='box-body'>
<table class='table table-bordered table-striped'>
<tr>
<th width='150'>Mata Pelajaran</th>
<td width='10'>:</td>
<td><?= $tugas['mapel'] ?></td>
</tr>
<tr>
<th>Tgl Mulai</th>
<td width='10'>:</td>
<td><?= $tugas['tgl_mulai'] ?></td>
</tr>
<tr>
<th>Tgl Selesai</th>
<td width='10'>:</td>
<td><?= $tugas['tgl_selesai'] ?></td>
</tr>
</table>
<br>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">Materi & Soal</a></li>
<li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="true">Kirim Jawaban</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_1">
<?php if ($tugas['file'] <> null) { ?>
Download Materi Pendukung<p>
<a target="_blank" href='<?= $homeurl ?>/berkas/<?= $tugas['file'] ?>' class="btn btn-primary"><?= $tugas['file'] ?></a>
<?php } ?>
<center>
<h3><?= $tugas['judul'] ?></h3>
</center>
<p><?= $tugas['tugas'] ?></p>
</div>
<div class="tab-pane" id="tab_2">
<?php
$kondisi = array(
'id_siswa' => $_SESSION['id_siswa'],
'id_tugas' => $tugas['id_tugas']
);
$jawab_tugas = fetch($koneksi, 'jawaban_tugas', $kondisi);
if ($jawab_tugas) {
$jawaban = $jawab_tugas['jawaban'];
} else {
$jawaban = "";
}
?>
<?php if ($jawab_tugas['nilai'] <> '') { ?>
<div class="alert alert-success" role="alert">
<strong>Jawaban telah dikoreksi dan dinilai</strong>
</div>
<h1>Nilai Kamu : <?= $jawab_tugas['nilai'] ?></h1>
<?php } else { ?>
<div class="alert alert-danger" role="alert">
<strong>Kerjakan dengan jujur dan benar, jawaban akan digunakan sebagai absen.</strong>
</div>
<form id='formjawaban'>
<input type="hidden" name="id_tugas" value="<?= $tugas['id_tugas'] ?>">
<div class="form-group">
<label for="">Lembar Jawaban</label>
<textarea class="form-control" name="jawaban" id="txtjawaban" rows="10"><?= $jawaban ?></textarea>
</div>
<?php if ($jawab_tugas['file'] == '') { ?>
<div class="form-group">
<label for="">Upload Jawaban</label>
<input type="file" class="form-control-file" name="file" aria-describedby="fileHelpId">
<small id="fileHelpId" class="form-text text-muted">jika jawaban diupload</small>
</div>
<?php } else { ?>
<div class="alert alert-success" role="alert">
<strong>file jawaban berhasil dikirim</strong>
<a href='<?= $homeurl ?>/tugas/<?= $jawab_tugas['file'] ?>' target="_blank">Lihat file</a>
</div>
<?php } ?>
<div class="form-group">
<button type="submit" class="btn btn-primary">Simpan Jawaban</button>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$('#formjawaban').submit(function(e) {
e.preventDefault();
var data = new FormData(this);
var homeurl = '<?= $homeurl ?>';
$.ajax({
type: 'POST',
url: homeurl + '/simpantugas.php',
enctype: 'multipart/form-data',
data: data,
cache: false,
contentType: false,
processData: false,
success: function(data) {
if (data = 'ok') {
toastr.success("jawaban berhasil dikirim");
} else {
toastr.error("jawaban gagal dikirim");
}
}
});
return false;
});
</script>
<script>
tinymce.init({
selector: '#txtjawaban',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools uploadimage paste'
],
toolbar: 'bold italic fontselect fontsizeselect | alignleft aligncenter alignright bullist numlist backcolor forecolor | emoticons code | imagetools link image paste ',
fontsize_formats: '8pt 10pt 12pt 14pt 18pt 24pt 36pt',
paste_data_images: true,
paste_as_text: true,
images_upload_handler: function(blobInfo, success, failure) {
success('data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64());
},
image_class_list: [{
title: 'Responsive',
value: 'img-responsive'
}],
setup: function(editor) {
editor.on('change', function() {
tinymce.triggerSave();
});
}
});
</script>