1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19:
20: class SystemBreadcrumb
21: {
22:
23: public $_directory;
24: public $_bread = array();
25: public $_help;
26: public $_tips;
27:
28: 29: 30:
31: public function __construct($directory)
32: {
33: $this->_directory = $directory;
34: }
35:
36: 37: 38: 39: 40: 41:
42: public function addLink($title = '', $link = '', $home = false)
43: {
44: $this->_bread[] = array(
45: 'link' => $link,
46: 'title' => $title,
47: 'home' => $home);
48: }
49:
50: 51: 52: 53:
54: public function addHelp($link = '')
55: {
56: $this->_help = $link;
57: }
58:
59: 60: 61: 62:
63: public function addTips($value)
64: {
65: $this->_tips = $value;
66: }
67:
68: 69: 70: 71:
72: public function render()
73: {
74: if (isset($GLOBALS['xoopsTpl'])) {
75: $GLOBALS['xoopsTpl']->assign('xo_sys_breadcrumb', $this->_bread);
76: $GLOBALS['xoopsTpl']->assign('xo_sys_help', $this->_help);
77: if ($this->_tips) {
78: if (xoops_getModuleOption('usetips', 'system')) {
79: $GLOBALS['xoopsTpl']->assign('xo_sys_tips', $this->_tips);
80: }
81: }
82:
83: if (file_exists(XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/help/' . $this->_directory . '.html')) {
84: $GLOBALS['xoopsTpl']->assign('help_content', XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/help/' . $this->_directory . '.html');
85: } else {
86: if (file_exists(XOOPS_ROOT_PATH . '/modules/system/language/english/help/' . $this->_directory . '.html')) {
87: $GLOBALS['xoopsTpl']->assign('help_content', XOOPS_ROOT_PATH . '/modules/system/language/english/help/' . $this->_directory . '.html');
88: } else {
89: $GLOBALS['xoopsTpl']->assign('load_error', 1);
90: }
91: }
92: } else {
93: $out = $menu = '<style type="text/css" media="screen">@import ' . XOOPS_URL . '/modules/system/css/menu.css;</style>';
94: $out .= '<ul id="xo-breadcrumb">';
95: foreach ($this->_bread as $menu) {
96: if ($menu['home']) {
97: $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '"><img src="images/home.png" alt="' . $menu['title'] . '" class="home" /></a></li>';
98: } else {
99: if ($menu['link'] != '') {
100: $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '">' . $menu['title'] . '</a></li>';
101: } else {
102: $out .= '<li>' . $menu['title'] . '</li>';
103: }
104: }
105: }
106: $out .= '</ul>';
107: if ($this->_tips) {
108: $out .= '<div class="tips">' . $this->_tips . '</div>';
109: }
110: echo $out;
111: }
112: }
113: }
114: