in it. It is important that you already have these users because LDAPab uses
them to authenticate.
-You need a webserver (peferable Apache) with PHP4. PHP4 needs to be compiled
-with LDAP support (compiled in or as extension)
+You need a webserver (peferable Apache) with PHP (4.3 or higher). PHP needs to
+be compiled with LDAP support (compiled in or as extension)
=== SETUP LDAPab ===
global $conf;
global $LDAP_CON;
if(!$conf['extended']) return;
-
+
$result = ldap_queryabooks('(objectClass=contactPerson)','marker');
$max = 0;
+ $min = 999999999;
$tags = array();
foreach ($result as $entry){
if(!empty($entry['marker']) && count($entry['marker'])){
if (empty($tags[$marker])) { $tags[$marker]=0; }
$tags[$marker] += 1;
if($tags[$marker] > $max) $max = $tags[$marker];
+ if($tags[$marker] < $min) $min = $tags[$marker];
}
}
}
ksort($tags);
+ tag_cloud_weight(&$tags,$min,$max,6);
$out = '';
foreach($tags as $tag => $cnt){
- $pct = round($cnt * 20 / $max); // percents from 0 to 20
-
- $out .= '<a href="index.php?marker='.rawurlencode($tag).'" class="tc'.$pct.'">';
+ $out .= '<a href="index.php?marker='.rawurlencode($tag).'" class="cloud_'.$cnt.'">';
$out .= htmlspecialchars($tag).'</a> ';
}
return $out;
}
-?>
+ /**
+ * Calculate weights for a nicer tagcloud distribution
+ */
+ function tag_cloud_weight(&$tags,$min,$max,$levels){
+ // calculate tresholds
+ $tresholds = array();
+ for($i=0; $i<=$levels; $i++){
+ $tresholds[$i] = pow($max - $min + 1, $i/$levels);
+ }
+
+ // assign weights
+ foreach($tags as $tag => $cnt){
+ foreach($tresholds as $tresh => $val){
+ if($cnt <= $val){
+ $tags[$tag] = $tresh;
+ break;
+ }
+ $tags[$tag] = $levels;
+ }
+ }
+ }
+
+
margin:2px;
font-family:Lucida,Helvetica,Verdana,Arial,Sans-Serif;
font-size: 12px;}
-
+
.photo {
margin-top: 1em;
border-width:1px;
}
/* TagCloud */
-a.tc0 { font-size: 80%; }
-a.tc1 { font-size: 100%; }
-a.tc2 { font-size: 120%; }
-a.tc3 { font-size: 130%; }
-a.tc4 { font-size: 140%; }
-a.tc5 { font-size: 150%; }
-a.tc6 { font-size: 160%; }
-a.tc7 { font-size: 170%; }
-a.tc8 { font-size: 180%; }
-a.tc9 { font-size: 190%; }
-a.tc10 { font-size: 200%; }
-a.tc11 { font-size: 210%; }
-a.tc12 { font-size: 220%; }
-a.tc13 { font-size: 230%; }
-a.tc14 { font-size: 240%; }
-a.tc15 { font-size: 250%; }
-a.tc16 { font-size: 260%; }
-a.tc17 { font-size: 270%; }
-a.tc18 { font-size: 280%; }
-a.tc19 { font-size: 290%; }
-a.tc20 { font-size: 300%; }
+a.cloud_0 {font-size: 90%; }
+a.cloud_1 {font-size: 110%; }
+a.cloud_2 {font-size: 140%; }
+a.cloud_3 {font-size: 150%; }
+a.cloud_4 {font-size: 160%; }
+a.cloud_5 {font-size: 180%; }
+a.cloud_6 {font-size: 200%; }
a.tag {
background: url(../pix/tag_blue.png) left center no-repeat;