Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jlopez
wicopa
Commits
0f55373e
Commit
0f55373e
authored
Jun 21, 2019
by
jlopez
Browse files
Add top public tags
parent
f973a66a
Changes
2
Hide whitespace changes
Inline
Side-by-side
container.php
View file @
0f55373e
...
...
@@ -13,6 +13,19 @@ $labels = array();
$tags
=
array
();
$descriptions
=
array
();
$rawtags
=
$db
->
getAllPublicTags
();
$alltags
=
array
();
foreach
(
$rawtags
as
$tgs
)
{
$etags
=
explode
(
" "
,
$tgs
);
foreach
(
$etags
as
$tgs2
)
{
array_push
(
$alltags
,
$tgs2
);
}
}
$alltags
=
array_count_values
(
$alltags
);
arsort
(
$alltags
);
$popularTags
=
array_slice
(
$alltags
,
0
,
5
);
if
(
isset
(
$_GET
[
'type'
]))
{
$type
=
$_GET
[
'type'
];
}
...
...
@@ -154,6 +167,21 @@ require_once "./inc/php/buildHeader.php";
</div>
<br/>
<div
class=
"row"
>
<div
class=
"col-12"
>
<h3
>
Top public tags :
</h3>
<?php
foreach
(
$popularTags
as
$key
=>
$value
){
echo
'<span class="badge"><h6>'
.
$key
.
'</h6></span>'
;
}
?>
</div>
</div>
<br/><br/>
<div
class=
"row"
>
...
...
dao/DBquery.php
View file @
0f55373e
...
...
@@ -180,6 +180,16 @@ class DBquery
return
$results
;
}
public
function
getAllPublicTags
()
{
$sql
=
"SELECT tags FROM `Container` WHERE tags <> '' AND visibility = 1;"
;
$result
=
mysqli_query
(
$this
->
dbh
,
$sql
);
$results
=
array
();
while
(
$row
=
mysqli_fetch_assoc
(
$result
)){
array_push
(
$results
,
$row
[
'tags'
]);
}
return
$results
;
}
public
function
getContainers
(
$type
,
$author
,
$labels
,
$tags
,
$descriptions
)
{
$sql
=
"SELECT * FROM `Container`"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment