From: hickert Date: Mon, 29 Nov 2010 12:38:11 +0000 (+0000) Subject: Updated manager detection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0369583758d63c91fa8907b457e932cfa988ac93;p=gosa.git Updated manager detection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20405 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/ihtml/themes/default/infoPage.tpl b/gosa-core/ihtml/themes/default/infoPage.tpl index b88159c62..51b153926 100644 --- a/gosa-core/ihtml/themes/default/infoPage.tpl +++ b/gosa-core/ihtml/themes/default/infoPage.tpl @@ -53,9 +53,10 @@ {if $managersCnt != 0}

{t}If you need assistance with this interface, please contact your administrative contact{/t}:

- {foreach from=$managers item=item} +
{$item.str} +
{/foreach} {/if}
diff --git a/gosa-core/plugins/generic/infoPage/class_infoPage.inc b/gosa-core/plugins/generic/infoPage/class_infoPage.inc index eb6519bed..129c38967 100644 --- a/gosa-core/plugins/generic/infoPage/class_infoPage.inc +++ b/gosa-core/plugins/generic/infoPage/class_infoPage.inc @@ -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 = "".set_post($managers[$dn]['sn'][0]).", ".set_post($managers[$dn]['givenName'][0]).""; - if(isset($managers[$dn]['mail'][0])){ - $mail = "
  • "._("Mail address").": ".set_post($managers[$dn]['mail'][0])."
  • "; - } - if(isset($managers[$dn]['telephoneNumber'][0])){ - $phone = "
  • "._("Phone number").": ".set_post($managers[$dn]['telephoneNumber'][0])."
  • "; - } - $managers[$dn]['str'] = "

    {$name}

    "; + 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 = "".set_post($managers[$dn]['sn'][0]).", ".set_post($managers[$dn]['givenName'][0]).""; + if(isset($managers[$dn]['mail'][0])){ + $mail = "
  • "._("Mail address").": ".set_post($managers[$dn]['mail'][0])."
  • "; + } + if(isset($managers[$dn]['telephoneNumber'][0])){ + $phone = "
  • "._("Phone number").": ".set_post($managers[$dn]['telephoneNumber'][0])."
  • "; + } + $managers[$dn]['str'] = "

    {$name}

    "; + } return($managers); } - + function execute() {