f90e19c3
Andrea Petta
plugin update
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
<?php
/*
PHPRtfLite
Copyright 2010-2012 Steffen Zeidler <sigma_z@sigma-scripts.de>
This file is part of PHPRtfLite.
PHPRtfLite is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PHPRtfLite is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PHPRtfLite. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* class for doucment head definition for footnotes and endnotes
* @version 1.2
* @author Steffen Zeidler <sigma_z@sigma-scripts.de>
* @copyright 2010-2012 Steffen Zeidler
* @package PHPRtfLite
* @subpackage PHPRtfLite_DocHead
*/
class PHPRtfLite_DocHead_Note
{
/**
* footnote type
* @var integer
*/
protected $_footnoteNumberingType = PHPRtfLite_Footnote::NUMTYPE_ARABIC_NUMBERS;
/**
* endnote type
* @var integer
*/
protected $_endnoteNumberingType = PHPRtfLite_Endnote::NUMTYPE_ROMAN_LC;
/**
* flag for restarting footnote numbering on each page
* @var boolean
*/
protected $_footnoteRestartEachPage = false;
/**
* flag for restarting endnote numbering on each page
* @var boolean
*/
protected $_endnoteRestartEachPage = false;
/**
* start number for footnotes
* @var integer
*/
protected $_footnoteStartNumber = 1;
/**
* start number for endnotes
* @var integer
*/
protected $_endnoteStartNumber = 1;
/**
* sets footnote numbering type
*
* @param integer $numberingType
*/
public function setFootnoteNumberingType($numberingType)
{
$this->_footnoteNumberingType = $numberingType;
}
/**
* gets footnote numbering type
*
* @return integer
*/
public function getFootnoteNumberingType()
{
return $this->_footnoteNumberingType;
}
/**
* sets endnote numbering type
*
* @param integer $numberingType
*/
public function setEndnoteNumberingType($numberingType)
{
$this->_endnoteNumberingType = $numberingType;
}
/**
* gets endnote numbering type
*
* @return integer
*/
public function getEndnoteNumberingType()
{
return $this->_endnoteNumberingType;
}
/**
* sets footnote start number
*
* @param integer $startNumber
*/
public function setFootnoteStartNumber($startNumber)
{
$this->_footnoteStartNumber = $startNumber;
}
/**
* gets footnote start number
*
* @return integer
*/
public function getFootnoteStartNumber()
{
return $this->_footnoteStartNumber;
}
/**
* sets endnote start number
*
* @param integer $startNumber
*/
public function setEndnoteStartNumber($startNumber)
{
$this->_endnoteStartNumber = $startNumber;
}
/**
* gets endnote start number
*
* @return integer
*/
public function getEndnoteStartNumber()
{
return $this->_endnoteStartNumber;
}
/**
* sets restart footnote number on each page
*/
public function setRestartFootnoteNumberEachPage()
{
$this->_footnoteRestartEachPage = true;
}
/**
* checks, if footnote numbering shall be started on each page
*
* @return boolean
*/
public function isRestartFootnoteNumberEachPage()
{
return $this->_endnoteRestartEachPage;
}
/**
* sets restart endnote number on each page
*/
public function setRestartEndnoteNumberEachPage()
{
$this->_endnoteRestartEachPage = true;
}
/**
* checks, if endnote numbering shall be started on each page
*
* @return boolean
*/
public function isRestartEndnoteNumberEachPage()
{
return $this->_endnoteRestartEachPage;
}
/**
* gets numbering type for notes
*
* @param integer $numbering
* @param string $prefix
* @return string
*/
public static function getNumberingTypeAsRtf($numbering, $prefix = '\ftnn')
{
switch ($numbering) {
default:
// const name NUMTYPE_ARABIC_NUMBERS
return $prefix . 'ar';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_LC:
return $prefix . 'alc';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_UC:
return $prefix . 'auc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_LC:
return $prefix . 'rlc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_UC:
return $prefix . 'ruc';
case PHPRtfLite_Footnote::NUMTYPE_CHICAGO;
return $prefix . 'chi';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_1:
return $prefix . 'chosung';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_2:
return $prefix . 'ganada';
case PHPRtfLite_Footnote::NUMTYPE_CIRCLE:
return $prefix . 'cnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_1:
return $prefix . 'dbnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_2:
return $prefix . 'dbnumd';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_3:
return $prefix . 'dbnumt';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_4:
return $prefix . 'dbnumk';
case PHPRtfLite_Footnote::NUMTYPE_DOUBLE_BYTE:
return $prefix . 'dbchar';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_1:
return $prefix . 'gbnum';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_2:
return $prefix . 'gbnumd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_3:
return $prefix . 'gbnuml';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_4:
return $prefix . 'gbnumk';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_1:
return $prefix . 'zodiac';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_2:
return $prefix . 'zodiacd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_3:
return $prefix . 'zodiacl';
}
}
/**
* renders document definition head for footnotes/endnotes
*
* @return string
*/
public function getContent()
{
$content = self::getNumberingTypeAsRtf($this->_footnoteNumberingType) . ' '
. self::getNumberingTypeAsRtf($this->_endnoteNumberingType, '\aftnn') . ' '
. '\ftnstart' . $this->_footnoteStartNumber . ' '
. '\aftnstart' . $this->_endnoteStartNumber . ' ';
if ($this->_footnoteRestartEachPage) {
$content .= '\ftnrstpg ';
}
if ($this->_endnoteRestartEachPage) {
$content .= '\aftnrstpg ';
}
return $content;
}
}
|