summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b152cb6)
raw | patch | inline | side by side (parent: b152cb6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 29 Nov 2010 07:44:12 +0000 (07:44 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 29 Nov 2010 07:44:12 +0000 (07:44 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20395 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/generic/infoPage/class_infoPage.inc | patch | blob | history |
diff --git a/gosa-core/plugins/generic/infoPage/class_infoPage.inc b/gosa-core/plugins/generic/infoPage/class_infoPage.inc
index d9d2c2db20bf911730c6db2e6237b912677a716e..f33c657ad673d050970c457f717f9a5bfe26687e 100644 (file)
class infoPage extends plugin
{
private $ui;
+ private $managers;
function __construct($config)
{
$this->config = &$config;
$this->ui = get_userinfo();
-
plugin::plugin($config, $this->ui->dn);
+
+
+ // Detect managers for the current user.
+ $this->managers = $this->detectManagers();
+ }
+
+ function detectManagers()
+ {
+ $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").": ".set_post($managers[$dn]['mail'][0])."</li>";
+ }
+ if(isset($managers[$dn]['telephoneNumber'][0])){
+ $phone = "<li>"._("Phone number").": ".set_post($managers[$dn]['telephoneNumber'][0])."</li>";
+ }
+ $managers[$dn]['str'] = "<p>{$name}<ul>{$phone}{$mail}</ul></p>";
+ }
+ }
+ return($managers);
}
+
function execute()
{
$smarty = get_smarty();
-
$personalInfoAllowed = FALSE;
foreach(array("uid","sn","givenName","street","l","o","ou","jpegPhoto","personalTitle",
"academicTitle","dateOfBirth","homePostalAddress","homePhone","departmentNumber",
$smarty->assign($attr, "");
if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", $attr))
&& isset($this->attrs[$attr][0])){
- $smarty->assign($attr, $this->attrs[$attr][0]);
+ $smarty->assign($attr,set_post( $this->attrs[$attr][0]));
$personalInfoAllowed = TRUE;
}
}
$smarty->assign("rand", rand(0, 99999999));
$smarty->assign("personalInfoAllowed", $personalInfoAllowed);
$smarty->assign("attrs", $this->attrs);
+ $smarty->assign("managers", $this->managers);
+ $smarty->assign("managersCnt", count($this->managers));
return($smarty->fetch(get_template_path("infoPage.tpl")));
}
}