XOOPS  2.6.0
systembreadcrumb.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 {
27  private $_directory = '';
28 
32  private $_bread = array();
33 
34  var $_help;
35 
36  var $_tips;
37 
43  private function __construct($fct)
44  {
45  if ($fct != '') {
46  $this->_directory = $fct;
47  }
48  }
49 
58  static public function getInstance($fct = '')
59  {
60  static $instance;
61  if (!isset($instance)) {
62  $class = __CLASS__;
63  $instance = new $class($fct);
64  }
65  return $instance;
66  }
67 
68  public function setDirectory($fct)
69  {
70  $this->_directory = $fct;
71  }
72 
77  function addLink($title = '', $link = '', $home = false)
78  {
79  $this->_bread[] = array(
80  'link' => $link, 'title' => $title, 'home' => $home
81  );
82  }
83 
88  function addHelp($link = '')
89  {
90  $this->_help = $link;
91  }
92 
97  function addTips($value)
98  {
99  $this->_tips = $value;
100  }
101 
106  function render()
107  {
109  if ($xoops->tpl()) {
110  $xoops->tpl()->assign('xo_sys_breadcrumb', $this->_bread);
111  $xoops->tpl()->assign('xo_sys_help', $this->_help);
112  if ($this->_tips) {
113  if ($xoops->getModuleConfig('usetips', 'system')) {
114  $xoops->tpl()->assign('xo_sys_tips', $this->_tips);
115  }
116  }
117  // Call template
118  if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/system/language/' . $xoops->getConfig('language') . '/help/' . $this->_directory . '.html')) {
119  $xoops->tpl()
120  ->assign('help_content', \XoopsBaseConfig::get('root-path') . '/modules/system/language/' . $xoops->getConfig('language') . '/help/' . $this->_directory . '.html');
121  } else {
122  if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/system/language/english/help/' . $this->_directory . '.html')) {
123  $xoops->tpl()
124  ->assign('help_content', \XoopsBaseConfig::get('root-path') . '/modules/system/language/english/help/' . $this->_directory . '.html');
125  } else {
126  $xoops->tpl()->assign('load_error', 1);
127  }
128  }
129  } else {
130  $out = $menu = '<style type="text/css" media="screen">@import ' . \XoopsBaseConfig::get('url') . '/modules/system/css/menu.css;</style>';
131  $out .= '<ul id="xo-breadcrumb">';
132  foreach ($this->_bread as $menu) {
133  if ($menu['home']) {
134  $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '"><img src="images/home.png" alt="' . $menu['title'] . '" class="home" /></a></li>';
135  } else {
136  if ($menu['link'] != '') {
137  $out .= '<li><a href="' . $menu['link'] . '" title="' . $menu['title'] . '">' . $menu['title'] . '</a></li>';
138  } else {
139  $out .= '<li>' . $menu['title'] . '</li>';
140  }
141  }
142  }
143  $out .= '</ul>';
144  if ($this->_tips) {
145  $out .= '<div class="tips">' . $this->_tips . '</div>';
146  }
147  echo $out;
148  }
149  }
150 }
static getInstance($fct= '')
static getInstance()
Definition: Xoops.php:160
addLink($title= '', $link= '', $home=false)
$link
Definition: userinfo.php:84
$fct
Definition: header.php:46
$xoops
Definition: admin.php:25
$menu
static fileExists($file)
Definition: xoopsload.php:506
static get($name)