diff options
Diffstat (limited to 'inc/poche')
-rwxr-xr-x | inc/poche/Poche.class.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index bf323c49..4ec724f9 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -466,6 +466,26 @@ class Poche | |||
466 | } | 466 | } |
467 | $tags = $this->store->retrieveTagsByEntry($id); | 467 | $tags = $this->store->retrieveTagsByEntry($id); |
468 | $all_tags = $this->store->retrieveAllTags($this->user->getId()); | 468 | $all_tags = $this->store->retrieveAllTags($this->user->getId()); |
469 | $maximus = 0; | ||
470 | foreach ($all_tags as $eachtag) { // search for the most times a tag is present | ||
471 | if ($eachtag["entriescount"] > $maximus) $maximus = $eachtag["entriescount"]; | ||
472 | } | ||
473 | foreach ($all_tags as $key => $eachtag) { // get the percentage of presence of each tag | ||
474 | $percent = floor(($eachtag["entriescount"] / $maximus) * 100); | ||
475 | |||
476 | if ($percent < 20): // assign a css class, depending on the number of entries count | ||
477 | $cssclass = 'smallesttag'; | ||
478 | elseif ($percent >= 20 and $percent < 40): | ||
479 | $cssclass = 'smalltag'; | ||
480 | elseif ($percent >= 40 and $percent < 60): | ||
481 | $cssclass = 'mediumtag'; | ||
482 | elseif ($percent >= 60 and $percent < 80): | ||
483 | $cssclass = 'largetag'; | ||
484 | else: | ||
485 | $cssclass = 'largesttag'; | ||
486 | endif; | ||
487 | $all_tags[$key]['cssclass'] = $cssclass; | ||
488 | } | ||
469 | $tpl_vars = array( | 489 | $tpl_vars = array( |
470 | 'entry_id' => $id, | 490 | 'entry_id' => $id, |
471 | 'tags' => $tags, | 491 | 'tags' => $tags, |