-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcategory_table.php
114 lines (92 loc) · 3.1 KB
/
category_table.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>expense tracker | Category</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
<!-- calender -->
<link type="text/css" href="scripts/jquery/css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet"/>
<script type="text/javascript" src="scripts/jquery/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="scripts/jquery/js/jquery-ui-1.10.3.custom.js"></script>
<link rel="stylesheet" href="css/" type="text/css"/>
<style type="text/css">
table.demoTbl {
border-collapse: collapse;
border-spacing: 0;
}
#tblCap {
font-weight: bold;
font-size: 15px;
margin: 1em auto .4em;
}
table.demoTbl .category {
width: 400px;
}
table.demoTbl .actions {
width: 150px;
}
table.demoTbl td, table.demoTbl th {
padding: 1px;
}
table.demoTbl th.first {
text-align: center;
padding: 3px;
background-color: #CCCCCC;
}
table.demoTbl td.cat {
text-align: left;
padding-left: 150px;
}
table.demoTbl td.actions {
text-align: center;
}
table.demoTbl td.foot {
text-align: center;
}
</style>
</head>
<body>
<?php
include_once('plugins/html_table.class.php');
include_once('config.db.php');
include_once('dbplugin.php');
include_once('plugins/KLogger.php');
$log = new KLogger ("/var/www/extracker/logs/", KLogger::DEBUG);
// arguments: id, class, border,
// can include associative array of optional additional attributes
$tbl = new HTML_Table('', 'demoTbl', 0);
$tbl->addCaption('Categories', 'cap', array('id' => 'tblCap'));
$tbl->addColgroup();
// span, class
$tbl->addCol(0, 'category');
$tbl->addCol(1, 'actions');
// thead
$tbl->addTSection('thead');
$tbl->addRow();
// arguments: cell content, class, type (default is 'data' for td, pass 'header' for th)
// can include associative array of optional additional attributes
$tbl->addCell('Category', 'first', 'header');
$tbl->addCell('Actions', 'first', 'header');
// tfoot
$tbl->addTSection('tfoot');
$tbl->addRow();
// span all 3 columns
$tbl->addCell('', 'foot', 'data', array('colspan' => 4));
// tbody
$tbl->addTSection('tbody');
// populate table
$getcatsql = "SELECT id,category from category WHERE status='ACTIVE'";
$cat_result = mysqli_query($db, $getcatsql);
$rowcount = mysqli_num_rows($cat_result);
while ($row = mysqli_fetch_array($cat_result)) {
$id = $row['id'];
$ctgry = $row['category'];
$actions = "<a href='category_handler.php?delid=" . $id . "' method='post'><button class=\"ui-state-default ui-corner-all\" title=\"delete record\" onclick=\"deleteRecord($recId)\"><span class=\"ui-icon ui-icon-trash\"></span></button></a>";
$tbl->addRow();
$tbl->addCell($ctgry, 'cat');
$tbl->addCell($actions, 'actions');
}
echo $tbl->display();
?>
</body>
</html>