|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
|
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
/** |
|
13
|
|
|
* tdmcreate module. |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
|
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
17
|
|
|
* |
|
18
|
|
|
* @since 2.5.0 |
|
19
|
|
|
* |
|
20
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
21
|
|
|
* |
|
22
|
|
|
* @version $Id: TemplatesUserBreadcrumbs.php 12258 2014-01-02 09:33:29Z timgno $ |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class TemplatesUserBreadcrumbs. |
|
27
|
|
|
*/ |
|
28
|
|
|
class TemplatesUserBreadcrumbs extends TDMCreateFile |
|
|
|
|
|
|
29
|
|
|
{ |
|
30
|
|
|
/* |
|
31
|
|
|
* @public function constructor |
|
32
|
|
|
* @param null |
|
33
|
|
|
*/ |
|
34
|
|
|
/** |
|
35
|
|
|
* |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct() |
|
38
|
|
|
{ |
|
39
|
|
|
parent::__construct(); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/* |
|
43
|
|
|
* @static function &getInstance |
|
44
|
|
|
* @param null |
|
45
|
|
|
*/ |
|
46
|
|
|
/** |
|
47
|
|
|
* @return TemplatesUserHeader |
|
48
|
|
|
*/ |
|
49
|
|
|
public static function &getInstance() |
|
50
|
|
|
{ |
|
51
|
|
|
static $instance = false; |
|
52
|
|
|
if (!$instance) { |
|
53
|
|
|
$instance = new self(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
return $instance; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/* |
|
60
|
|
|
* @public function write |
|
61
|
|
|
* @param string $module |
|
62
|
|
|
* @param mixed $tables |
|
63
|
|
|
* @param string $filename |
|
64
|
|
|
*/ |
|
65
|
|
|
/** |
|
66
|
|
|
* @param $module |
|
67
|
|
|
* @param $tables |
|
68
|
|
|
* @param $filename |
|
69
|
|
|
*/ |
|
70
|
|
|
public function write($module, $filename) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->setModule($module); |
|
73
|
|
|
$this->setFileName($filename); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/* |
|
77
|
|
|
* @public function render |
|
78
|
|
|
* @param null |
|
79
|
|
|
*/ |
|
80
|
|
|
/** |
|
81
|
|
|
* @return bool|string |
|
82
|
|
|
*/ |
|
83
|
|
|
public function render() |
|
84
|
|
|
{ |
|
85
|
|
|
$module = $this->getModule(); |
|
86
|
|
|
$filename = $this->getFileName(); |
|
87
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
88
|
|
|
$tf = TDMCreateFile::getInstance(); |
|
89
|
|
|
$sc = TDMCreateSmartyCode::getInstance(); |
|
90
|
|
|
$hc = TDMCreateHtmlCode::getInstance(); |
|
91
|
|
|
$t = "\t"; |
|
92
|
|
|
$title = $sc->getSmartyDoubleVar('itm', 'title'); |
|
93
|
|
|
$titleElse = $sc->getSmartyDoubleVar('itm', 'title', $t."\t").PHP_EOL; |
|
94
|
|
|
$link = $sc->getSmartyDoubleVar('itm', 'link'); |
|
95
|
|
|
$glyph = $hc->getHtmlTag('i', array('class' => 'glyphicon glyphicon-home'), '', false, true); |
|
96
|
|
|
$anchor = $hc->getHtmlAnchor('<{xoAppUrl index.php}>', $glyph, 'home'); |
|
97
|
|
|
$into = $hc->getHtmlTag('li', array('class' => 'bc-item'), $anchor, false, true, $t).PHP_EOL; |
|
98
|
|
|
$anchorIf = $hc->getHtmlAnchor($link, $title, $title, '', '', '', $t."\t").PHP_EOL; |
|
99
|
|
|
$breadcrumb = $sc->getSmartyConditions('itm.link', '', '', $anchorIf, $titleElse, false, false, $t); |
|
100
|
|
|
$foreach = $hc->getHtmlTag('li', array('class' => 'bc-item'), $breadcrumb, false, false, $t); |
|
101
|
|
|
$into .= $sc->getSmartyForeach('itm', 'xoBreadcrumbs', $foreach, 'bcloop', '', $t); |
|
102
|
|
|
|
|
103
|
|
|
$content = $hc->getHtmlTag('ol', array('class' => 'breadcrumb'), $into); |
|
104
|
|
|
|
|
105
|
|
|
$tf->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
|
106
|
|
|
|
|
107
|
|
|
return $tf->renderFile(); |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.