Code

Updated manager detection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Nov 2010 12:38:11 +0000 (12:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Nov 2010 12:38:11 +0000 (12:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20405 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/ihtml/themes/default/infoPage.tpl
gosa-core/plugins/generic/infoPage/class_infoPage.inc

index b88159c62526a1117dd98192f20784eb377269f4..51b1539262c21d56aad62850d6fb104e6c91b184 100644 (file)
 {if $managersCnt != 0}
     <hr>
     <h3>{t}If you need assistance with this interface, please contact your administrative contact{/t}:</h3>
-
     {foreach from=$managers item=item}
+        <div style='float: left; width:50%;'>
         {$item.str}
+        </div>
     {/foreach}
 {/if}
 <hr>
index eb6519bed676a6bc2a3b378098ff572c333a534c..129c389676d6d748e01ce227a849684cffa86074 100644 (file)
@@ -45,38 +45,50 @@ class infoPage extends plugin
 
     function detectManagers()
     {
+
+        // Check if we've an own manager set
+        $ldap = $this->config->get_ldap_link(); 
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->cat($this->dn, array('manager'));
+        $attrs = $ldap->fetch();
+        $dns = array();
+        if(isset($attrs['manager'][0])){
+            $dns['PERSONAL'] = $attrs['manager'][0];
+        }
+
+        // Get next department manager dn
         $dn = $this->dn;
         $max = 10;
-        $dns = array();
-        $dns[] = $dn;
         while(strlen($dn) >= strlen($this->config->current['BASE']) && $max){
             $dn = preg_replace("/^[^,]+,/","",$dn);
-            $dns[] = $dn;
             $max --;
-        }
-        $ldap = $this->config->get_ldap_link(); 
-        $ldap->cd($this->config->current['BASE']);
-        $managers = array();
-        foreach($dns as $dn){
             $ldap->cat($dn, array('manager'));
             $attrs = $ldap->fetch();
-            if(isset($attrs['manager'])){
-                $ldap->cat($attrs['manager'][0], array('sn','givenName','mail','telephoneNumber'));
-                $managers[$dn] = $ldap->fetch();
-                $name = $phone = $mail = "";
-                $name = "<b>".set_post($managers[$dn]['sn'][0]).", ".set_post($managers[$dn]['givenName'][0])."</b>";
-                if(isset($managers[$dn]['mail'][0])){
-                    $mail = "<li>"._("Mail address").":&nbsp;".set_post($managers[$dn]['mail'][0])."</li>";
-                }
-                if(isset($managers[$dn]['telephoneNumber'][0])){
-                    $phone = "<li>"._("Phone number").":&nbsp;".set_post($managers[$dn]['telephoneNumber'][0])."</li>";
-                }
-                $managers[$dn]['str'] = "<p>{$name}<ul>{$phone}{$mail}</ul></p>";
+            if(isset($attrs['manager'][0])){
+                $dns['DEPARTMENT'] = $attrs['manager'][0];
+                break;
             }
         }
+
+        // Resolve collected manager dns
+        $managers = array();
+        foreach($dns as $type => $dn){
+            $ldap->cat($dn,array('sn','givenName','mail','telephoneNumber'));
+            $managers[$dn] = $ldap->fetch();
+            $managers[$dn]['type'] = $type;
+            $name = $phone = $mail = "";
+            $name = "<b>".set_post($managers[$dn]['sn'][0]).", ".set_post($managers[$dn]['givenName'][0])."</b>";
+            if(isset($managers[$dn]['mail'][0])){
+                $mail = "<li>"._("Mail address").":&nbsp;".set_post($managers[$dn]['mail'][0])."</li>";
+            }
+            if(isset($managers[$dn]['telephoneNumber'][0])){
+                $phone = "<li>"._("Phone number").":&nbsp;".set_post($managers[$dn]['telephoneNumber'][0])."</li>";
+            }
+            $managers[$dn]['str'] = "<p>{$name}<ul>{$phone}{$mail}</ul></p>";
+        }
         return($managers);
     }
-    
+
 
     function execute()
     {