-
Notifications
You must be signed in to change notification settings - Fork 2
/
history.php
118 lines (102 loc) · 2.64 KB
/
history.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
<?php
$basepath = true;
$data['title'] = "Analysis History";
$data['menu'] = 3;
$data['submenu'] = 31;
include "header.php";
?>
<br>
<h1>Analysis History</h1>
<form action="" method="get">
<div class="input-group">
<input type="search" name="keyword" class="form-control" placeholder="Filter Analysis History" value="<?=isset($_GET['keyword']) ? $_GET['keyword'] : "" ?>">
<div class="input-group-btn">
<button class="btn btn-primary"><span class="fa fa-search"></span></button>
</div>
</div>
</form>
<table class="data table pmd-table table-sm">
<thead>
<tr>
<th>#</th>
<th>Tanggal Analisis</th>
<th>Kalimat Komentar</th>
<th>Stemmed Token</th>
<th>Sentimen</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$limit = 20;
$offset = ($page - 1) * $limit;
$addQ = "";
if(isset($_GET['keyword'])){
$addQ = "WHERE komentar LIKE ".quote("%".$_GET['keyword']."%")." OR stem LIKE ".quote("%".$_GET['keyword']."%");
}
$sql = query("SELECT * FROM skripsi_rekap $addQ ORDER BY tgl DESC LIMIT $offset,$limit");
$no = $offset + 1;
foreach($sql as $row){
$stem = explode(",",$row['stem']);
$stemmed = "";
if(count($stem) > 0){
$stemmed = "<span class='label label-info'>".implode("</span> <span class='label label-info'>",$stem)."</span>";
}
if($row['sentimen'] == 0){
$senti = "<span class='btn btn-danger'>Negatif</span>";
}
else if($row['sentimen'] == 1){
$senti = "<span class='btn btn-success'>Positif</span>";
}
else{
$senti = "<span class='btn btn-warning'>Netral</span>";
}
if($row['flag'] == 0){
//belum ditandai
}
else{
//sudah ditandai
}
echo "
<tr>
<td>$no</td>
<td>".indo_date($row['tgl'],"full")."</td>
<td>$row[komentar]</td>
<td>$stemmed</td>
<td>$senti</td>
<td></td>
</tr>
";
$no++;
}
$prev = 1;
$next = $page;
$totalpage = query("SELECT COUNT(no) AS jml FROM skripsi_rekap $addQ");
$rt = $totalpage->fetch();
$ntotal = ceil($rt['jml'] / $limit);
$btncl1 = $btncl2 = "disabled";
if($page > 1){
$prev = $page - 1;
$btncl1 = "";
}
if($page < $ntotal){
$next = $page + 1;
$btncl2 = "";
}
$ktd = "";
if(isset($_GET['katadasar'])){
$ktd = "&katadasar=".$_GET['katadasar'];
}
$urla = "?page=$prev".$ktd;
$urlb = "?page=$next".$ktd;
?>
</tbody>
</table>
<div class="btn-group btn-group-justified">
<a href="<?=$urla?>" class="<?=$btncl1?> btn pmd-ripple-effect btn-primary"><span class="fa fa-caret-left"></span> Prev</a>
<a href="<?=$urlb?>" class="<?=$btncl2?> btn pmd-ripple-effect btn-primary">Next <span class="fa fa-caret-right"></span></a>
</div>
<?php
include "footer.php";
?>