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 = "Missing: ".get_class($class);
20 }else{
21 $str = _($class->pathTitle);
22 }
23 }
25 // In case of tabs add the 'dn' of the entry
26 if($class instanceOf tabs){
28 // Convert dn to cn
29 if(isset($class->dn)){
30 if(!session::is_set("pathNavigator::registerPlugin:{$class->dn}")){
31 global $config;
32 $ldap = $config->get_ldap_link();
33 $ldap->cat($class->dn, array('cn'));
34 if($ldap->count()){
35 $attrs = $ldap->fetch();
36 $str = $attrs['cn'][0];
37 }
38 session::set("pathNavigator::registerPlugin:{$class->dn}", $str);
39 }
40 $str = session::get("pathNavigator::registerPlugin:{$class->dn}");
41 if(empty($title)){
42 $title = $class->dn;
43 }
44 }
45 }
47 // Simple string given
48 if(is_string($class)){
49 $str = $class;
50 }
52 if(!empty($str)){
53 $cur = session::get('pathNavigator::position');
55 if(!empty($title)) $title = " title='{$title}' ";
57 $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
58 session::set('pathNavigator::position', $cur);
59 }
60 }
62 static function getCurrentPath()
63 {
64 $path = session::get('pathNavigator::position');
65 if(empty($path)){
66 $path = "<li class='left path-element'>"._("Welcome to GOsa")."</li>";
67 }
68 return($path);
69 }
71 static function clear()
72 {
73 session::set('pathNavigator::position','');
74 }
75 }
77 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
78 ?>