Code

Updated role listing
[gosa.git] / gosa-core / include / class_pathNavigator.inc
1 <?php
3 class pathNavigator
4 {
6   static function registerPlugin($class, $title= "")
7   {
8     $str = "";
10     // Display headline of management plugins
11     if($class instanceOf management && isset($class->plHeadline)){
12       $str= _($class->plHeadline);
13     }
15     // Shown title of sub dialogs (They have no plHeadline set.)
16     if($class instanceOf plugin && !isset($class->plHeadline)){
17       if(!empty($class->pathTitle)){
18         $str = _($class->pathTitle);
19       }
20     }
21   
22     // In case of tabs add the 'dn' of the entry 
23     if($class instanceOf tabs){
25       // Convert dn to cn
26       if(isset($class->dn)){
27         if(!session::is_set("pathNavigator::registerPlugin:{$class->dn}")){
28           global $config;
29           $ldap = $config->get_ldap_link();
31           if(!empty($class->dn)){
32             $namingAttr = preg_replace("/^([^=]*)=.*$/","\\1",$class->dn);
34             $ldap->cat($class->dn, array($namingAttr));
35             if($ldap->count()){
36               $attrs = $ldap->fetch();
37               $str = $attrs[$namingAttr][0];
38             }
39             session::set("pathNavigator::registerPlugin:{$class->dn}", $str);
40           }
41         }
42         $str = session::get("pathNavigator::registerPlugin:{$class->dn}");
43         if(empty($title)){
44           $title = $class->dn;
45         }
46       }
47     }
49     // Simple string given 
50     if(is_string($class)){
51       $str = $class;
52     }
53     
54     if(!empty($str)){
55       $cur = session::get('pathNavigator::position');
57       if(!empty($title)) $title = " title='{$title}' ";
59       $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
60       session::set('pathNavigator::position', $cur);
61     }
62   }
64   static function getCurrentPath()
65   {
66     $path = session::get('pathNavigator::position');
67     if(empty($path)){
68       $path = "<li class='left path-element'>"._("Welcome to GOsa")."</li>";
69     }
70     return($path);
71   }
73   static function clear()
74   {
75     session::set('pathNavigator::position','');
76   }
77 }
79 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
80 ?>