diff --git a/src/IDF/Forge.php b/src/IDF/Forge.php index 832323d..df199a0 100644 --- a/src/IDF/Forge.php +++ b/src/IDF/Forge.php @@ -60,12 +60,18 @@ class IDF_Forge 'order' => 'class ASC, lcname ASC' )); + $maxProjectCount = 0; + foreach ($tagList as $tag) { + $maxProjectCount = max($maxProjectCount, $tag->project_count); + } + $tags = array(); foreach ($tagList as $tag) { // group by class if (!array_key_exists($tag->class, $tags)) { $tags[$tag->class] = array(); } + $tag->rel_project_count = $tag->project_count / (double) $maxProjectCount; $tags[$tag->class][] = $tag; } return $tags; diff --git a/src/IDF/templates/idf/listProjects.html b/src/IDF/templates/idf/listProjects.html index aa340e6..6359e1e 100644 --- a/src/IDF/templates/idf/listProjects.html +++ b/src/IDF/templates/idf/listProjects.html @@ -19,7 +19,12 @@
{foreach $projectLabels as $class => $labels}
{$class}
{foreach $labels as $idx => $label} -
{$label.name}{if $idx != count($labels) - 1},{/if}
+ {* 0.75 - or 75% - is the minimum font size we'd like to see in this tag cloud *} + {assign $fontScale = round($label.rel_project_count * 100) + 75} +
{$label.name}{if $idx != count($labels) - 1},{/if}
{/foreach} {/foreach}
{if $tag}