tag cloud is present, #1122 is implemented

This commit is contained in:
Thomas Citharel
2015-03-08 14:47:22 +01:00
parent 512ff18015
commit ab87a7fe69
6 changed files with 86 additions and 3 deletions

View File

@ -466,6 +466,26 @@ class Poche
}
$tags = $this->store->retrieveTagsByEntry($id);
$all_tags = $this->store->retrieveAllTags($this->user->getId());
$maximus = 0;
foreach ($all_tags as $eachtag) { // search for the most times a tag is present
if ($eachtag["entriescount"] > $maximus) $maximus = $eachtag["entriescount"];
}
foreach ($all_tags as $key => $eachtag) { // get the percentage of presence of each tag
$percent = floor(($eachtag["entriescount"] / $maximus) * 100);
if ($percent < 20): // assign a css class, depending on the number of entries count
$cssclass = 'smallesttag';
elseif ($percent >= 20 and $percent < 40):
$cssclass = 'smalltag';
elseif ($percent >= 40 and $percent < 60):
$cssclass = 'mediumtag';
elseif ($percent >= 60 and $percent < 80):
$cssclass = 'largetag';
else:
$cssclass = 'largesttag';
endif;
$all_tags[$key]['cssclass'] = $cssclass;
}
$tpl_vars = array(
'entry_id' => $id,
'tags' => $tags,