-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplateview.php
150 lines (94 loc) · 2.92 KB
/
templateview.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
<?php
require_once('function.php');
dbconnect();
session_start();
if (!is_user()) {
redirect('index.php');
}
?>
<?php
$user = $_SESSION['username'];
$usid = $pdo->query("SELECT id FROM users WHERE username='".$user."'");
$usid = $usid->fetch(PDO::FETCH_ASSOC);
$uid = $usid['id'];
include ('header.php');
?>
<link href="css/style.default.css" rel="stylesheet">
<link href="css/jquery.datatables.css" rel="stylesheet">
<div class="pageheader">
<h2><i class="fa fa-th-list"></i> SMS Template List</h2>
</div>
<div class="contentpanel">
<div class="panel panel-default">
<div class="panel-body">
<div class="clearfix mb30"></div>
<div class="table-responsive">
<table class="table table-striped" id="table2">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Message</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
<?php
$ddaa = $pdo->query("SELECT id, title, msg FROM template ORDER BY id");
while ($data = $ddaa->fetch(PDO::FETCH_ASSOC))
{
echo " <tr>
<td>$data[id]</td>
<td>$data[title]</td>
<td>$data[msg]</td>
<td>
<a href='templateedit.php?id=$data[id]' class='btn btn-info btn-xs'>Edit</a>
<a href='templatedelete.php?id=$data[id]' class='btn btn-danger btn-xs'>DELETE</a>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div><!-- table-responsive -->
</div>
</div>
</div><!-- contentpanel -->
</section>
<?php
include ('footer.php');
?>
<script src="js/jquery.datatables.min.js"></script>
<script src="js/select2.min.js"></script>
<script>
jQuery(document).ready(function() {
"use strict";
jQuery('#table1').dataTable();
jQuery('#table2').dataTable({
"sPaginationType": "full_numbers"
});
// Select2
jQuery('select').select2({
minimumResultsForSearch: -1
});
jQuery('select').removeClass('form-control');
// Delete row in a table
jQuery('.delete-row').click(function(){
var c = confirm("Continue delete?");
if(c)
jQuery(this).closest('tr').fadeOut(function(){
jQuery(this).remove();
});
return false;
});
// Show aciton upon row hover
jQuery('.table-hidaction tbody tr').hover(function(){
jQuery(this).find('.table-action-hide a').animate({opacity: 1});
},function(){
jQuery(this).find('.table-action-hide a').animate({opacity: 0});
});
});
</script>
</body>
</html>