601b8908294b97cfd890a12ee1b035f9d9c02ffd
1 <?php
3 class pathNavigator
4 {
6 static function registerPlugin($class)
7 {
9 $str = $title = "";
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 $title = $class->dn;
42 }
43 }
45 // Simple string given
46 if(is_string($class)){
47 $str = $class;
48 }
50 if(!empty($str)){
51 $cur = session::get('pathNavigator::position');
53 if(!empty($title)) $title = " title='{$title}' ";
55 $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
56 session::set('pathNavigator::position', $cur);
57 }
58 }
60 static function getCurrentPath()
61 {
62 $path = session::get('pathNavigator::position');
63 if(empty($path)){
64 $path = "<li class='left path-element'>"._("Welcome to GOsa")."</li>";
65 }
66 return($path);
67 }
69 static function clear()
70 {
71 session::set('pathNavigator::position','');
72 }
73 }
75 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
76 ?>