-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
198 lines (187 loc) · 9.58 KB
/
index.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php require_once('header.php'); ?>
<div>
<ul class="breadcrumb">
<li>
<a href="index.php">Home</a> <span class="divider">/</span>
</li>
<li>
<a href="index.php">Dashboard</a>
</li>
</ul>
</div>
<?php
// member
$sql_total_members = "SELECT count(*) AS count_member
FROM public.". DB_PREFIX ."user, public.". DB_PREFIX ."user_role
WHERE ". DB_PREFIX ."user_role.id_user_role = ". DB_PREFIX ."user.id_user_role";
$total_members = DB::getOne($sql_total_members);
$member_info = DB::getAll($sql_total_members);
$sql_new_members = "SELECT count(*) AS new_member
FROM public.". DB_PREFIX ."user, public.". DB_PREFIX ."user_role
WHERE ". DB_PREFIX ."user_role.id_user_role = ". DB_PREFIX ."user.id_user_role
AND date_registered > now()::date - 1";
$new_members = DB::getOne($sql_new_members);
// categories
$sql_total_categories = "SELECT count(*) AS count_categories
FROM public.tbl_categories";
$total_categories = DB::getOne($sql_total_categories);
$categories_info = DB::getAll($sql_total_categories);
$sql_new_categories = "SELECT count(*) AS new_categories
FROM public.". DB_PREFIX ."categories
WHERE date_created > now()::date - 1";
$new_categories = DB::getOne($sql_new_categories);
// images
$sql_total_images = "SELECT count(*) AS count_image
FROM public.". DB_PREFIX ."image";
$total_images = DB::getOne($sql_total_images);
$image_info = DB::getAll($sql_total_images);
$sql_new_images = "SELECT count(*) AS new_image
FROM public.". DB_PREFIX ."image
WHERE timestamp::date > now()::date - 1";
$new_images = DB::getOne($sql_new_images);
// logs
// get contents of a file into a string
$filename = "logs/error_logs.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
<div class="sortable row-fluid">
<a data-rel="tooltip" title="<?php echo $new_members[0]['new_member']; ?> new members." class="well span3 top-block" href="#">
<span class="icon32 icon-red icon-user"></span>
<div>Total Members</div>
<div><?php echo $total_members[0]['count_member']; ?></div>
<span class="notification"><?php echo $new_members[0]['new_member']; ?></span>
</a>
<a data-rel="tooltip" title="<?php echo $new_categories[0]; ?> new image categories." class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-star-on"></span>
<div>Image Categories</div>
<div><?php echo $total_categories[0];?></div>
<span class="notification green"><?php echo $new_categories[0]; ?></span>
</a>
<a data-rel="tooltip" title="<?php echo $new_images[0]; ?> new images." class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-image"></span>
<div>Total Images</div>
<div><?php echo $total_images[0]; ?></div>
<span class="notification yellow"><?php echo $new_images[0]; ?></span>
</a>
<a data-rel="tooltip" title="12 new logs." class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-book"></span>
<div>Logs</div>
<div><?php echo substr_count($contents, 'ERRNO');?></div>
<!--
<span class="notification red">12</span>
-->
</a>
</div>
<div class="row-fluid">
<div class="box span12">
<div class="box-header well">
<h2><i class="icon-info-sign"></i> Introduction</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<h1>CBIRES <small>free, open-source, online, content based image retrieval system.</small></h1>
<p>It's a live demo of the CBIRES, which was created due to an assignement during our graduate degree in CS. :)</p>
<p><b>At the moment you cannot delete images from the databse, you can only insert new ones !</b></p>
<p class="center">
<a href="https://github.com/kirk86/cbires" class="btn btn-large"><i class="icon-download-alt"></i> Download Page</a>
</p>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="row-fluid sortable">
<div class="box span4">
<div class="box-header well" data-original-title>
<h2><i class="icon-user"></i> Member Activity</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<?php $sql_member_info = "SELECT *
FROM public.". DB_PREFIX ."user, public.". DB_PREFIX ."user_role
WHERE ". DB_PREFIX ."user_role.id_user_role = ". DB_PREFIX ."user.id_user_role
ORDER BY date_registered DESC
LIMIT 4";
$member_info = DB::getAll($sql_member_info);
?>
<div class="box-content">
<div class="box-content">
<ul class="dashboard-list">
<?php foreach ($member_info as $key => $value) : ?>
<li>
<a href="#">
<img class="dashboard-avatar" alt="<?php echo $member_info[$key]['username']; ?>" src="http://www.gravatar.com/avatar/<?php echo md5( strtolower( trim( "[email protected]" ) ) ); ?>.png?s=50" /></a>
<strong>Name:</strong> <a href="#"><?php echo ucfirst($member_info[$key]['username']); ?>
</a><br />
<strong>Since:</strong> <?php echo date("d/m/Y", strtotime($member_info[$key]['date_registered'])); ?> <br />
<strong>Status:</strong> <span class="<?php if ($member_info[$key]['status'] == 'active') echo 'label label-success';
elseif ($member_info[$key]['status'] == 'pending') echo 'label label-warning';
elseif ($member_info[$key]['status'] == 'banned') echo 'label label-important';
elseif ($member_info[$key]['status'] == 'inactive') echo 'label'; ?>">
<?php if ($member_info[$key]['status'] == 'active') echo 'Active';
elseif ($member_info[$key]['status'] == 'pending') echo 'Pending';
elseif ($member_info[$key]['status'] == 'banned') echo 'Banned';
elseif ($member_info[$key]['status'] == 'inactive') echo 'Inactive'; ?>
</span>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div><!--/span-->
<!-- YOU CAN ADD MORE GRIDS HERE BELOW -->
<!-- START OF Image Categories -->
<div class="box span4">
<div class="box-header well" data-original-title>
<h2><i class="icon-star"></i> Image Categories </h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<?php $sql_category_info = "SELECT *
FROM public.". DB_PREFIX ."categories
ORDER BY RANDOM()
LIMIT 4";
$category_info = DB::getAll($sql_category_info);
?>
<div class="box-content">
<div class="box-content">
<ul class="dashboard-list">
<?php foreach ($category_info as $key => $value) : ?>
<li>
<a href="#">
<img class="dashboard-avatar" alt="<?php echo ucfirst($category_info[$key]['category_name']); ?>" src="img/categories/<?php echo ucfirst($category_info[$key]['category_image']);?>" /></a>
<strong>Name:</strong> <a href="#"><?php echo ucfirst($category_info[$key]['category_name']); ?>
</a><br />
<strong>Created:</strong> <?php echo date("d/m/Y", strtotime($category_info[$key]['date_created'])); ?> <br />
<div style="clear:both;"></div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div><!--/span-->
<!-- END OF Image Categories -->
<!-- START OF Donut chart -->
<div class="box span4">
<div class="box-header well" data-original-title>
<h2><i class="icon-list-alt"></i> Statistics Categories</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<div id="donutchart" style="height: 300px;"></div>
</div>
</div>
<!-- END OF Donut chart -->
</div><!--/row-->
<?php require_once('footer.php'); ?>