XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
breadcrumb.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
23 {
24  /* Variables */
26  var $_bread = array();
27  var $_help;
28  var $_tips;
29 
30  function __construct( $directory )
31  {
32  $this->_directory = $directory;
33  }
34 
39  function addLink( $title='', $link='', $home=false )
40  {
41  $this->_bread[] = array(
42  'link' => $link,
43  'title' => $title,
44  'home' => $home
45  );
46  }
47 
52  function addHelp( $link = '')
53  {
54  $this->_help = $link;
55  }
56 
61  function addTips($value)
62  {
63  $this->_tips = $value;
64  }
65 
70  function render()
71  {
72  if (isset($GLOBALS['xoopsTpl'])) {
73  $GLOBALS['xoopsTpl']->assign('xo_sys_breadcrumb', $this->_bread);
74  $GLOBALS['xoopsTpl']->assign('xo_sys_help', $this->_help);
75  if ($this->_tips) {
76  if (xoops_getModuleOption('usetips', 'system')){
77  $GLOBALS['xoopsTpl']->assign('xo_sys_tips', $this->_tips);
78  }
79  }
80  // Call template
81  if ( file_exists( XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/help/' . $this->_directory . '.html' ) ) {
82  $GLOBALS['xoopsTpl']->assign( 'help_content', XOOPS_ROOT_PATH . '/modules/system/language/' . $GLOBALS['xoopsConfig']['language'] . '/help/' . $this->_directory . '.html' );
83  }else{
84  if ( file_exists( XOOPS_ROOT_PATH . '/modules/system/language/english/help/' . $this->_directory . '.html' ) ) {
85  $GLOBALS['xoopsTpl']->assign( 'help_content', XOOPS_ROOT_PATH.'/modules/system/language/english/help/' . $this->_directory . '.html' );
86  } else {
87  $GLOBALS['xoopsTpl']->assign('load_error', 1);
88  }
89  }
90  } else {
91  $out = $menu = '<style type="text/css" media="screen">@import ' . XOOPS_URL . '/modules/system/css/menu.css;</style>';
92  $out .= '<ul id="xo-breadcrumb">';
93  foreach ($this->_bread as $menu) {
94  if ($menu['home']) {
95  $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '"><img src="images/home.png" alt="' . $menu['title'] . '" class="home" /></a></li>';
96  } else {
97  if ($menu['link'] != '') {
98  $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '">' . $menu['title'] . '</a></li>';
99  } else {
100  $out .= '<li>' . $menu['title'] . '</li>';
101  }
102  }
103  }
104  $out .= '</ul>';
105  if ($this->_tips) {
106  $out .= '<div class="tips">' . $this->_tips . '</div>';
107  }
108  echo $out;
109  }
110  }
111 
112 }
113 
114 ?>