|
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
|
|
|
|
|
12
|
|
|
namespace Xmf\Template; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* PrintContent implements a simple page layout suited to printing |
|
16
|
|
|
* |
|
17
|
|
|
* @category Xmf\Template\Breadcrumb |
|
18
|
|
|
* @package Xmf |
|
19
|
|
|
* @author trabis <[email protected]> |
|
20
|
|
|
* @author The SmartFactory <www.smartfactory.ca> |
|
21
|
|
|
* @copyright 2011-2016 XOOPS Project (http://xoops.org) |
|
22
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
23
|
|
|
* @version Release: 1.0 |
|
24
|
|
|
* @link http://xoops.org |
|
25
|
|
|
* @since 1.0 |
|
26
|
|
|
*/ |
|
27
|
|
|
class PrintContent extends AbstractTemplate |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
private $title = ''; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
private $description = ''; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
private $content = ''; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var bool |
|
46
|
|
|
*/ |
|
47
|
|
|
private $pagetitle = false; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var int |
|
51
|
|
|
*/ |
|
52
|
|
|
private $width = 680; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* init - called by parent::_construct |
|
56
|
|
|
* |
|
57
|
|
|
* @return void |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function init() |
|
60
|
|
|
{ |
|
61
|
|
|
$this->setTemplate('module:xmf/xmf_print.tpl'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Render the print template |
|
66
|
|
|
* |
|
67
|
|
|
* @return void |
|
68
|
|
|
*/ |
|
69
|
|
|
protected function render() |
|
70
|
|
|
{ |
|
71
|
|
|
$this->tpl->assign('xmf_print_pageTitle', $this->pagetitle ? $this->pagetitle : $this->title); |
|
72
|
|
|
$this->tpl->assign('xmf_print_title', $this->title); |
|
73
|
|
|
$this->tpl->assign('xmf_print_description', $this->description); |
|
74
|
|
|
$this->tpl->assign('xmf_print_content', $this->content); |
|
75
|
|
|
$this->tpl->assign('xmf_print_width', $this->width); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* setContent |
|
80
|
|
|
* |
|
81
|
|
|
* @param string $content page content |
|
82
|
|
|
* |
|
83
|
|
|
* @return PrintContent |
|
84
|
|
|
*/ |
|
85
|
|
|
public function setContent($content) |
|
86
|
|
|
{ |
|
87
|
|
|
$this->content = $content; |
|
88
|
|
|
return $this; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* getContent |
|
93
|
|
|
* |
|
94
|
|
|
* @return string page content |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getContent() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->content; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* setDescription |
|
103
|
|
|
* |
|
104
|
|
|
* @param string $description page description |
|
105
|
|
|
* |
|
106
|
|
|
* @return PrintContent |
|
107
|
|
|
*/ |
|
108
|
|
|
public function setDescription($description) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->description = $description; |
|
111
|
|
|
return $this; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* getDescription |
|
116
|
|
|
* |
|
117
|
|
|
* @return string page description |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getDescription() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->description; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* setPagetitle |
|
126
|
|
|
* |
|
127
|
|
|
* @param boolean $pagetitle use page title |
|
128
|
|
|
* |
|
129
|
|
|
* @return PrintContent |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setPagetitle($pagetitle) |
|
132
|
|
|
{ |
|
133
|
|
|
$this->pagetitle = $pagetitle; |
|
134
|
|
|
return $this; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* getPagetitle |
|
139
|
|
|
* |
|
140
|
|
|
* @return boolean use page title |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getPagetitle() |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->pagetitle; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* setTitle |
|
149
|
|
|
* |
|
150
|
|
|
* @param string $title page title |
|
151
|
|
|
* |
|
152
|
|
|
* @return PrintContent |
|
153
|
|
|
*/ |
|
154
|
|
|
public function setTitle($title) |
|
155
|
|
|
{ |
|
156
|
|
|
$this->title = $title; |
|
157
|
|
|
return $this; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* getTitle |
|
162
|
|
|
* |
|
163
|
|
|
* @return string page title |
|
164
|
|
|
*/ |
|
165
|
|
|
public function getTitle() |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->title; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* setWidth |
|
172
|
|
|
* |
|
173
|
|
|
* @param int $width page width in pixels |
|
174
|
|
|
* |
|
175
|
|
|
* @return PrintContent |
|
176
|
|
|
*/ |
|
177
|
|
|
public function setWidth($width) |
|
178
|
|
|
{ |
|
179
|
|
|
$this->width = $width; |
|
180
|
|
|
return $this; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* getWidth |
|
185
|
|
|
* |
|
186
|
|
|
* @return int page width in pixels |
|
187
|
|
|
*/ |
|
188
|
|
|
public function getWidth() |
|
189
|
|
|
{ |
|
190
|
|
|
return $this->width; |
|
191
|
|
|
} |
|
192
|
|
|
} |
|
193
|
|
|
|