-
Notifications
You must be signed in to change notification settings - Fork 71
/
tools-list.php
163 lines (137 loc) · 5.37 KB
/
tools-list.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
<!DOCTYPE html>
<html>
<?php
include("assets/includes/head.php");
?>
<body>
<?php
include("assets/includes/header.php")
?>
<!-- Page content -->
<div class="container-fluid mt--7">
<!-- Table -->
<div class="row">
<div class="col">
<div class="card shadow">
<div class="card-header bg-transparent">
<h2 class="mb-0">Tools List
<button class="btn btn-dark btn-sm float-right" type="button" data-toggle="collapse" data-target="#collapse-filter" style="float: right;">+ Show filters</button>
</h2>
</div>
<div class="card-body">
<div class="collapse" id="collapse-filter">
<div class="card card-body">
<?php include("assets/includes/tools-categories.php"); ?>
</div>
</div>
<div class="row icon-examples">
<?php
$con = getConnectionDB() or die ("Could not connect to database.");
$sql = $con->prepare("SELECT id, name, category, category2, released, categories, avatar FROM tools ORDER BY name;");
$sql->execute();
$resultados = $sql->fetchAll(PDO::FETCH_ASSOC);
// FOREACH BEGINS
foreach ($resultados as $resultado) {
$id = $resultado['id'];
$name = $resultado['name'];
$category = $resultado['category'];
$category2 = $resultado['category2'];
$released = $resultado['released'];
$categories = $resultado['categories'];
$avatar = $resultado['avatar'];
if(is_null($avatar)) {
$avatar = 'assets/img/kali.png';
}
?>
<div class="col-sm-12 col-md-12 col-lg-6 col-xl-6 filter <?php echo $categories?>">
<?php
if(is_null($released)) {
echo "
<div class='card zoom-effect bg-white mb-3 text-white'>
<div class='card-body'>
<div class='row'>
<div class='col'>
<span class='h2 font-weight-bold mb-0'>$name</span>
<h5 class='card-title text-uppercase text-muted mb-0'>$category";
if (!is_null($category2)) {
echo ", $category2";
}
echo "</h5>
</div>
<div class='col-auto'>
<div class='icon icon-shape text-white rounded-circle shadow'";
echo " style='background-image: url($avatar); background-size: cover; background-position: center'> ";
echo "
</div>
</div>
</div>
<p class='mt-3 mb-0 text-muted'>
<span class='text-danger mr-2'>Unavailable</span>
<span class='text-nowrap'></span>
</p>
</div>
</div>
";
} else {
echo "
<a href='selected-tool.php?id=$id' style='text-decoration: none;'>
<div class='card zoom-effect mb-3 text-white bg-success'>
<div class='card-body'>
<div class='row'>
<div class='col'>
<span class='h2 font-weight-bold mb-0 text-white'>$name</span>
<h5 class='card-title text-uppercase mb-0' style='color: #84edff;'>$category";
if (!is_null($category2)) {
echo ", $category2";
}
echo "</h5>
</div>
<div class='col-auto'>
<div class='icon icon-shape text-white rounded-circle shadow'";
echo " style='background-image: url($avatar); background-size: cover; background-position: center'> ";
echo "
</div>
</div>
</div>
<p class='mt-3 mb-0 text-muted'>
<span class='text-white mr-2'>Available</span>
<span class='text-nowrap'></span>
</p>
</div>
</div>
</a>
";
}
?>
</div>
<?php
// FOREACH ENDS
}
?>
</div>
</div>
</div>
<?php
include("assets/includes/footer.php")
?>
<script type="text/javascript">
$(document).ready(function(){
$(".filter-button").click(function(){
var value = $(this).attr('data-filter');
if(value == "all")
{
//$('.filter').removeClass('hidden');
$('.filter').show('1000');
}
else
{
// $('.filter[filter-item="'+value+'"]').removeClass('hidden');
// $(".filter").not('.filter[filter-item="'+value+'"]').addClass('hidden');
$(".filter").not('.'+value).hide('3000');
$('.filter').filter('.'+value).show('3000');
}
});
});
</script>
</body>
</html>