From ab87a7fe6934b5fa0f06964c67a27826774126b4 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 8 Mar 2015 14:47:22 +0100 Subject: tag cloud is present, #1122 is implemented --- inc/poche/Poche.class.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'inc/poche/Poche.class.php') 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 } $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, -- cgit v1.2.3