1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Extcal\Common; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
/** |
15
|
|
|
* Breadcrumb Class |
16
|
|
|
* |
17
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
18
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
19
|
|
|
* @author lucio <[email protected]> |
20
|
|
|
* @package extcal |
21
|
|
|
* |
22
|
|
|
* Example: |
23
|
|
|
* $breadcrumb = new PedigreeBreadcrumb(); |
24
|
|
|
* $breadcrumb->addLink( 'bread 1', 'index1.php' ); |
25
|
|
|
* $breadcrumb->addLink( 'bread 2', '' ); |
26
|
|
|
* $breadcrumb->addLink( 'bread 3', 'index3.php' ); |
27
|
|
|
* echo $breadcrumb->render(); |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Breadcrumb |
32
|
|
|
*/ |
33
|
|
|
class Breadcrumb |
34
|
|
|
{ |
35
|
|
|
public $dirname; |
36
|
|
|
private $bread = []; |
37
|
|
|
|
38
|
|
|
public function __construct() |
39
|
|
|
{ |
40
|
|
|
$this->dirname = \basename(dirname(__DIR__, 2)); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Add link to breadcrumb |
45
|
|
|
* |
46
|
|
|
* @param string $title |
47
|
|
|
* @param string $link |
48
|
|
|
*/ |
49
|
|
|
public function addLink($title = '', $link = '') |
50
|
|
|
{ |
51
|
|
|
$this->bread[] = [ |
52
|
|
|
'link' => $link, |
53
|
|
|
'title' => $title, |
54
|
|
|
]; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Render BreadCrumb |
59
|
|
|
*/ |
60
|
|
|
public function render() |
61
|
|
|
{ |
62
|
|
|
/* |
63
|
|
|
TODO if you want to use the render code below, |
64
|
|
|
1) create ./templates/extcal_common_breadcrumb.tpl) |
65
|
|
|
2) add declaration to xoops_version.php |
66
|
|
|
*/ |
67
|
|
|
/* |
68
|
|
|
if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) { |
69
|
|
|
require $GLOBALS['xoops']->path('class/theme.php'); |
70
|
|
|
|
71
|
|
|
$GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
require $GLOBALS['xoops']->path('class/template.php'); |
75
|
|
|
|
76
|
|
|
$breadcrumbTpl = new \XoopsTpl(); |
77
|
|
|
|
78
|
|
|
$breadcrumbTpl->assign('breadcrumb', $this->bread); |
79
|
|
|
|
80
|
|
|
$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
81
|
|
|
|
82
|
|
|
unset($breadcrumbTpl); |
83
|
|
|
|
84
|
|
|
return $html; |
85
|
|
|
*/ |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|