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