2 require_once('inc/init.php');
7 $smarty->assign('tagcloud',tag_cloud());
9 header('Content-Type: text/html; charset=utf-8');
10 $smarty->display('tags.tpl');
16 if(!$conf['extended']) return;
18 $result = ldap_queryabooks('(objectClass=inetOrgPerson)',$FIELDS['_marker']);
23 foreach ($result as $entry){
24 if(!empty($entry[$FIELDS['_marker']]) && count($entry[$FIELDS['_marker']])){
25 foreach($entry[$FIELDS['_marker']] as $marker){
26 $marker = strtolower($marker);
27 if (empty($tags[$marker])) { $tags[$marker]=0; }
29 if($tags[$marker] > $max) $max = $tags[$marker];
30 if($tags[$marker] < $min) $min = $tags[$marker];
35 tag_cloud_weight(&$tags,$min,$max,6);
38 foreach($tags as $tag => $cnt){
39 $out .= '<a href="index.php?marker='.rawurlencode($tag).'" class="cloud_'.$cnt.'">';
40 $out .= htmlspecialchars($tag).'</a> ';
47 * Calculate weights for a nicer tagcloud distribution
49 function tag_cloud_weight(&$tags,$min,$max,$levels){
50 // calculate tresholds
52 for($i=0; $i<=$levels; $i++){
53 $tresholds[$i] = pow($max - $min + 1, $i/$levels);
57 foreach($tags as $tag => $cnt){
58 foreach($tresholds as $tresh => $val){
63 $tags[$tag] = $levels;