commit | author | age
|
47124c
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/include/html.php | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2005-2008, RoundCube Dev, - Switzerland | |
|
9 |
| Licensed under the GNU GPL | |
|
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Helper class to create valid XHTML code | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id: $ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
|
|
23 |
/** |
|
24 |
* Class for HTML code creation |
|
25 |
* |
|
26 |
* @package HTML |
|
27 |
*/ |
|
28 |
class html |
|
29 |
{ |
|
30 |
protected $tagname; |
|
31 |
protected $attrib = array(); |
|
32 |
protected $allowed; |
|
33 |
protected $content; |
|
34 |
|
8fa58e
|
35 |
public static $common_attrib = array('id','class','style','title','align'); |
47124c
|
36 |
public static $containers = array('div','span','p','h1','h2','h3','form','textarea'); |
T |
37 |
public static $lc_tags = true; |
|
38 |
|
|
39 |
/** |
|
40 |
* Constructor |
|
41 |
* |
|
42 |
* @param array Hash array with tag attributes |
|
43 |
*/ |
|
44 |
public function __construct($attrib = array()) |
|
45 |
{ |
|
46 |
if (is_array($attrib)) { |
|
47 |
$this->attrib = $attrib; |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* Return the tag code |
|
53 |
* |
|
54 |
* @return string The finally composed HTML tag |
|
55 |
*/ |
|
56 |
public function show() |
|
57 |
{ |
|
58 |
return self::tag($this->tagname, $this->attrib, $this->content, $this->allowed); |
|
59 |
} |
|
60 |
|
|
61 |
/****** STATIC METHODS *******/ |
|
62 |
|
|
63 |
/** |
|
64 |
* Generic method to create a HTML tag |
|
65 |
* |
|
66 |
* @param string Tag name |
|
67 |
* @param array Tag attributes as key/value pairs |
|
68 |
* @param string Optinal Tag content (creates a container tag) |
|
69 |
* @param array List with allowed attributes, omit to allow all |
|
70 |
* @return string The XHTML tag |
|
71 |
*/ |
|
72 |
public static function tag($tagname, $attrib = array(), $content = null, $allowed_attrib = null) |
|
73 |
{ |
|
74 |
$inline_tags = array('a','span','img'); |
|
75 |
$suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : ''; |
|
76 |
|
|
77 |
$tagname = self::$lc_tags ? strtolower($tagname) : $tagname; |
|
78 |
if ($content || in_array($tagname, self::$containers)) { |
|
79 |
$templ = $attrib['noclose'] ? "<%s%s>%s" : "<%s%s>%s</%s>%s"; |
|
80 |
unset($attrib['noclose']); |
|
81 |
return sprintf($templ, $tagname, self::attrib_string($attrib, $allowed_attrib), $content, $tagname, $suffix); |
|
82 |
} |
|
83 |
else { |
|
84 |
return sprintf("<%s%s />%s", $tagname, self::attrib_string($attrib, $allowed_attrib), $suffix); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Derrived method for <div> containers |
|
90 |
* |
|
91 |
* @param mixed Hash array with tag attributes or string with class name |
|
92 |
* @param string Div content |
|
93 |
* @return string HTML code |
|
94 |
* @see html::tag() |
|
95 |
*/ |
|
96 |
public static function div($attr = null, $cont = null) |
|
97 |
{ |
|
98 |
if (is_string($attr)) { |
|
99 |
$attr = array('class' => $attr); |
|
100 |
} |
|
101 |
return self::tag('div', $attr, $cont, self::$common_attrib); |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Derrived method for <p> blocks |
|
106 |
* |
|
107 |
* @param mixed Hash array with tag attributes or string with class name |
|
108 |
* @param string Paragraph content |
|
109 |
* @return string HTML code |
|
110 |
* @see html::tag() |
|
111 |
*/ |
|
112 |
public static function p($attr = null, $cont = null) |
|
113 |
{ |
|
114 |
if (is_string($attr)) { |
|
115 |
$attr = array('class' => $attr); |
|
116 |
} |
|
117 |
return self::tag('p', $attr, $cont, self::$common_attrib); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Derrived method to create <img /> |
|
122 |
* |
|
123 |
* @param mixed Hash array with tag attributes or string with image source (src) |
|
124 |
* @return string HTML code |
|
125 |
* @see html::tag() |
|
126 |
*/ |
|
127 |
public static function img($attr = null) |
|
128 |
{ |
|
129 |
if (is_string($attr)) { |
|
130 |
$attr = array('src' => $attr); |
|
131 |
} |
|
132 |
return self::tag('img', $attr + array('alt' => ''), null, array_merge(self::$common_attrib, array('src','alt','width','height','border','usemap'))); |
|
133 |
} |
|
134 |
|
|
135 |
/** |
|
136 |
* Derrived method for link tags |
|
137 |
* |
|
138 |
* @param mixed Hash array with tag attributes or string with link location (href) |
|
139 |
* @param string Link content |
|
140 |
* @return string HTML code |
|
141 |
* @see html::tag() |
|
142 |
*/ |
|
143 |
public static function a($attr, $cont) |
|
144 |
{ |
|
145 |
if (is_string($attr)) { |
|
146 |
$attr = array('href' => $attr); |
|
147 |
} |
|
148 |
return self::tag('a', $attr, $cont, array_merge(self::$common_attrib, array('href','target','name','onclick','onmouseover','onmouseout'))); |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* Derrived method for inline span tags |
|
153 |
* |
|
154 |
* @param mixed Hash array with tag attributes or string with class name |
|
155 |
* @param string Tag content |
|
156 |
* @return string HTML code |
|
157 |
* @see html::tag() |
|
158 |
*/ |
|
159 |
public static function span($attr, $cont) |
|
160 |
{ |
|
161 |
if (is_string($attr)) { |
|
162 |
$attr = array('class' => $attr); |
|
163 |
} |
|
164 |
return self::tag('span', $attr, $cont, self::$common_attrib); |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* Derrived method for form element labels |
|
169 |
* |
|
170 |
* @param mixed Hash array with tag attributes or string with 'for' attrib |
|
171 |
* @param string Tag content |
|
172 |
* @return string HTML code |
|
173 |
* @see html::tag() |
|
174 |
*/ |
|
175 |
public static function label($attr, $cont) |
|
176 |
{ |
|
177 |
if (is_string($attr)) { |
|
178 |
$attr = array('for' => $attr); |
|
179 |
} |
|
180 |
return self::tag('label', $attr, $cont, array_merge(self::$common_attrib, array('for'))); |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* Derrived method for line breaks |
|
185 |
* |
|
186 |
* @return string HTML code |
|
187 |
* @see html::tag() |
|
188 |
*/ |
|
189 |
public static function br() |
|
190 |
{ |
|
191 |
return self::tag('br'); |
|
192 |
} |
|
193 |
|
|
194 |
/** |
|
195 |
* Create string with attributes |
|
196 |
* |
|
197 |
* @param array Associative arry with tag attributes |
|
198 |
* @param array List of allowed attributes |
|
199 |
* @return string Valid attribute string |
|
200 |
*/ |
|
201 |
public static function attrib_string($attrib = array(), $allowed = null) |
|
202 |
{ |
|
203 |
if (empty($attrib)) { |
|
204 |
return ''; |
|
205 |
} |
|
206 |
|
|
207 |
$allowed_f = array_flip((array)$allowed); |
|
208 |
$attrib_arr = array(); |
|
209 |
foreach ($attrib as $key => $value) { |
|
210 |
// skip size if not numeric |
|
211 |
if (($key=='size' && !is_numeric($value))) { |
|
212 |
continue; |
|
213 |
} |
|
214 |
|
|
215 |
// ignore "internal" or not allowed attributes |
|
216 |
if ($key == 'nl' || ($allowed && !isset($allowed_f[$key])) || $value === null) { |
|
217 |
continue; |
|
218 |
} |
|
219 |
|
|
220 |
// skip empty eventhandlers |
|
221 |
if (preg_match('/^on[a-z]+/', $key) && !$value) { |
|
222 |
continue; |
|
223 |
} |
|
224 |
|
|
225 |
// attributes with no value |
|
226 |
if (in_array($key, array('checked', 'multiple', 'disabled', 'selected'))) { |
|
227 |
if ($value) { |
|
228 |
$attrib_arr[] = sprintf('%s="%s"', $key, $key); |
|
229 |
} |
|
230 |
} |
|
231 |
else if ($key=='value') { |
|
232 |
$attrib_arr[] = sprintf('%s="%s"', $key, Q($value, 'strict', false)); |
|
233 |
} |
|
234 |
else { |
|
235 |
$attrib_arr[] = sprintf('%s="%s"', $key, Q($value)); |
|
236 |
} |
|
237 |
} |
|
238 |
return count($attrib_arr) ? ' '.implode(' ', $attrib_arr) : ''; |
|
239 |
} |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* Class to create an HTML input field |
|
244 |
* |
|
245 |
* @package HTML |
|
246 |
*/ |
|
247 |
class html_inputfield extends html |
|
248 |
{ |
|
249 |
protected $tagname = 'input'; |
|
250 |
protected $type = 'text'; |
|
251 |
|
|
252 |
public function __construct($attrib = array()) |
|
253 |
{ |
|
254 |
if (is_array($attrib)) { |
|
255 |
$this->attrib = $attrib; |
|
256 |
} |
|
257 |
|
|
258 |
if ($attrib['type']) { |
|
259 |
$this->type = $attrib['type']; |
|
260 |
} |
|
261 |
|
|
262 |
if ($attrib['newline']) { |
|
263 |
$this->newline = true; |
|
264 |
} |
|
265 |
} |
|
266 |
|
|
267 |
/** |
|
268 |
* Compose input tag |
|
269 |
* |
|
270 |
* @param string Field value |
|
271 |
* @param array Additional attributes to override |
|
272 |
* @return string HTML output |
|
273 |
*/ |
|
274 |
public function show($value = null, $attrib = null) |
|
275 |
{ |
|
276 |
// overwrite object attributes |
|
277 |
if (is_array($attrib)) { |
|
278 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
279 |
} |
|
280 |
|
|
281 |
// set value attribute |
|
282 |
if ($value !== null) { |
|
283 |
$this->attrib['value'] = $value; |
|
284 |
} |
|
285 |
// set type |
|
286 |
$this->attrib['type'] = $this->type; |
|
287 |
return parent::show(); |
|
288 |
} |
|
289 |
} |
|
290 |
|
|
291 |
/** |
|
292 |
* Class to create an HTML password field |
|
293 |
* |
|
294 |
* @package HTML |
|
295 |
*/ |
|
296 |
class html_passwordfield extends html_inputfield |
|
297 |
{ |
|
298 |
protected $type = 'password'; |
|
299 |
} |
|
300 |
|
|
301 |
/** |
|
302 |
* Class to create an hidden HTML input field |
|
303 |
* |
|
304 |
* @package HTML |
|
305 |
*/ |
|
306 |
|
|
307 |
class html_hiddenfield extends html_inputfield |
|
308 |
{ |
|
309 |
protected $type = 'hidden'; |
|
310 |
protected $fields_arr = array(); |
|
311 |
protected $newline = true; |
|
312 |
|
|
313 |
/** |
|
314 |
* Constructor |
|
315 |
* |
|
316 |
* @param array Named tag attributes |
|
317 |
*/ |
|
318 |
public function __construct($attrib = null) |
|
319 |
{ |
|
320 |
if (is_array($attrib)) { |
|
321 |
$this->add($attrib); |
|
322 |
} |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 |
* Add a hidden field to this instance |
|
327 |
* |
|
328 |
* @param array Named tag attributes |
|
329 |
*/ |
|
330 |
public function add($attrib) |
|
331 |
{ |
|
332 |
$this->fields_arr[] = $attrib; |
|
333 |
} |
|
334 |
|
|
335 |
/** |
|
336 |
* Create HTML code for the hidden fields |
|
337 |
* |
|
338 |
* @return string Final HTML code |
|
339 |
*/ |
|
340 |
public function show() |
|
341 |
{ |
|
342 |
$out = ''; |
|
343 |
foreach ($this->fields_arr as $attrib) { |
|
344 |
$out .= self::tag($this->tagname, array('type' => $this->type) + $attrib); |
|
345 |
} |
|
346 |
return $out; |
|
347 |
} |
|
348 |
} |
|
349 |
|
|
350 |
/** |
|
351 |
* Class to create HTML radio buttons |
|
352 |
* |
|
353 |
* @package HTML |
|
354 |
*/ |
|
355 |
class html_radiobutton extends html_inputfield |
|
356 |
{ |
|
357 |
protected $type = 'radio'; |
|
358 |
|
|
359 |
/** |
|
360 |
* Get HTML code for this object |
|
361 |
* |
|
362 |
* @param string Value of the checked field |
|
363 |
* @param array Additional attributes to override |
|
364 |
* @return string HTML output |
|
365 |
*/ |
|
366 |
public function show($value = '', $attrib = null) |
|
367 |
{ |
|
368 |
// overwrite object attributes |
|
369 |
if (is_array($attrib)) { |
|
370 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
371 |
} |
|
372 |
|
|
373 |
// set value attribute |
ff6def
|
374 |
$this->attrib['checked'] = ((string)$value == (string)$this->attrib['value']); |
47124c
|
375 |
|
T |
376 |
return parent::show(); |
|
377 |
} |
|
378 |
} |
|
379 |
|
|
380 |
/** |
|
381 |
* Class to create HTML checkboxes |
|
382 |
* |
|
383 |
* @package HTML |
|
384 |
*/ |
|
385 |
class html_checkbox extends html_inputfield |
|
386 |
{ |
|
387 |
protected $type = 'checkbox'; |
|
388 |
|
|
389 |
/** |
|
390 |
* Get HTML code for this object |
|
391 |
* |
|
392 |
* @param string Value of the checked field |
|
393 |
* @param array Additional attributes to override |
|
394 |
* @return string HTML output |
|
395 |
*/ |
|
396 |
public function show($value = '', $attrib = null) |
|
397 |
{ |
|
398 |
// overwrite object attributes |
|
399 |
if (is_array($attrib)) { |
|
400 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
401 |
} |
|
402 |
|
|
403 |
// set value attribute |
ff6def
|
404 |
$this->attrib['checked'] = ((string)$value == (string)$this->attrib['value']); |
47124c
|
405 |
|
T |
406 |
return parent::show(); |
|
407 |
} |
|
408 |
} |
|
409 |
|
|
410 |
/** |
|
411 |
* Class to create an HTML textarea |
|
412 |
* |
|
413 |
* @package HTML |
|
414 |
*/ |
|
415 |
class html_textarea extends html |
|
416 |
{ |
|
417 |
protected $tagname = 'textarea'; |
405aba
|
418 |
protected $allowed_attrib = array('name','rows','cols','wrap','tabindex'); |
47124c
|
419 |
|
T |
420 |
/** |
|
421 |
* Get HTML code for this object |
|
422 |
* |
|
423 |
* @param string Textbox value |
|
424 |
* @param array Additional attributes to override |
|
425 |
* @return string HTML output |
|
426 |
*/ |
|
427 |
public function show($value = '', $attrib = null) |
|
428 |
{ |
|
429 |
// overwrite object attributes |
|
430 |
if (is_array($attrib)) { |
|
431 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
432 |
} |
|
433 |
|
|
434 |
// take value attribute as content |
54d830
|
435 |
if (empty($value) && !empty($this->attrib['value'])) { |
47124c
|
436 |
$value = $this->attrib['value']; |
T |
437 |
} |
|
438 |
|
|
439 |
// make shure we don't print the value attribute |
|
440 |
if (isset($this->attrib['value'])) { |
|
441 |
unset($this->attrib['value']); |
|
442 |
} |
|
443 |
|
6025c8
|
444 |
if (!empty($value) && !ereg('mce_editor', $this->attrib['class'])) { |
54d830
|
445 |
$value = Q($value, 'strict', false); |
47124c
|
446 |
} |
6025c8
|
447 |
|
54d830
|
448 |
return self::tag($this->tagname, $this->attrib, $value, array_merge(self::$common_attrib, $this->allowed_attrib)); |
47124c
|
449 |
} |
T |
450 |
} |
|
451 |
|
|
452 |
/** |
|
453 |
* Builder for HTML drop-down menus |
|
454 |
* Syntax:<pre> |
|
455 |
* // create instance. arguments are used to set attributes of select-tag |
|
456 |
* $select = new html_select(array('name' => 'fieldname')); |
|
457 |
* |
|
458 |
* // add one option |
|
459 |
* $select->add('Switzerland', 'CH'); |
|
460 |
* |
|
461 |
* // add multiple options |
|
462 |
* $select->add(array('Switzerland','Germany'), array('CH','DE')); |
|
463 |
* |
|
464 |
* // generate pulldown with selection 'Switzerland' and return html-code |
|
465 |
* // as second argument the same attributes available to instanciate can be used |
|
466 |
* print $select->show('CH'); |
|
467 |
* </pre> |
|
468 |
* |
|
469 |
* @package HTML |
|
470 |
*/ |
|
471 |
class html_select extends html |
|
472 |
{ |
|
473 |
protected $tagname = 'select'; |
|
474 |
protected $options = array(); |
|
475 |
|
|
476 |
/** |
|
477 |
* Add a new option to this drop-down |
|
478 |
* |
|
479 |
* @param mixed Option name or array with option names |
|
480 |
* @param mixed Option value or array with option values |
|
481 |
*/ |
|
482 |
public function add($names, $values = null) |
|
483 |
{ |
|
484 |
if (is_array($names)) { |
|
485 |
foreach ($names as $i => $text) { |
|
486 |
$this->options[] = array('text' => $text, 'value' => $values[$i]); |
|
487 |
} |
|
488 |
} |
|
489 |
else { |
|
490 |
$this->options[] = array('text' => $names, 'value' => $values); |
|
491 |
} |
|
492 |
} |
|
493 |
|
|
494 |
|
|
495 |
/** |
|
496 |
* Get HTML code for this object |
|
497 |
* |
|
498 |
* @param string Value of the selection option |
|
499 |
* @param array Additional attributes to override |
|
500 |
* @return string HTML output |
|
501 |
*/ |
|
502 |
public function show($select = array(), $attrib = null) |
|
503 |
{ |
|
504 |
// overwrite object attributes |
|
505 |
if (is_array($attrib)) { |
|
506 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
507 |
} |
|
508 |
|
|
509 |
$this->content = "\n"; |
|
510 |
$select = (array)$select; |
|
511 |
foreach ($this->options as $option) { |
|
512 |
$attr = array( |
|
513 |
'value' => $option['value'], |
ff6def
|
514 |
'selected' => (in_array($option['value'], $select, true) || |
A |
515 |
in_array($option['text'], $select, true)) ? 1 : null); |
47124c
|
516 |
|
T |
517 |
$this->content .= self::tag('option', $attr, Q($option['text'])); |
|
518 |
} |
|
519 |
return parent::show(); |
|
520 |
} |
|
521 |
} |
|
522 |
|
|
523 |
|
|
524 |
/** |
|
525 |
* Class to build an HTML table |
|
526 |
* |
|
527 |
* @package HTML |
|
528 |
*/ |
|
529 |
class html_table extends html |
|
530 |
{ |
|
531 |
protected $tagname = 'table'; |
|
532 |
protected $allowed = array('id','class','style','width','summary','cellpadding','cellspacing','border'); |
|
533 |
private $header = array(); |
|
534 |
private $rows = array(); |
|
535 |
private $rowindex = 0; |
|
536 |
private $colindex = 0; |
|
537 |
|
|
538 |
|
|
539 |
public function __construct($attrib = array()) |
|
540 |
{ |
|
541 |
$this->attrib = array_merge($attrib, array('summary' => '', 'border' => 0)); |
|
542 |
} |
|
543 |
|
|
544 |
/** |
|
545 |
* Add a table cell |
|
546 |
* |
|
547 |
* @param array Cell attributes |
|
548 |
* @param string Cell content |
|
549 |
*/ |
|
550 |
public function add($attr, $cont) |
|
551 |
{ |
|
552 |
if (is_string($attr)) { |
|
553 |
$attr = array('class' => $attr); |
|
554 |
} |
|
555 |
|
|
556 |
$cell = new stdClass; |
|
557 |
$cell->attrib = $attr; |
|
558 |
$cell->content = $cont; |
|
559 |
|
|
560 |
$this->rows[$this->rowindex]->cells[$this->colindex] = $cell; |
|
561 |
$this->colindex++; |
|
562 |
|
|
563 |
if ($this->attrib['cols'] && $this->colindex == $this->attrib['cols']) { |
|
564 |
$this->add_row(); |
|
565 |
} |
|
566 |
} |
|
567 |
|
|
568 |
/** |
|
569 |
* Add a table header cell |
|
570 |
* |
|
571 |
* @param array Cell attributes |
|
572 |
* @param string Cell content |
|
573 |
*/ |
83a763
|
574 |
public function add_header($attr, $cont) |
47124c
|
575 |
{ |
T |
576 |
if (is_string($attr)) |
|
577 |
$attr = array('class' => $attr); |
|
578 |
|
|
579 |
$cell = new stdClass; |
|
580 |
$cell->attrib = $attr; |
|
581 |
$cell->content = $cont; |
|
582 |
$this->header[] = $cell; |
|
583 |
} |
|
584 |
|
|
585 |
/** |
|
586 |
* Jump to next row |
|
587 |
* |
|
588 |
* @param array Row attributes |
|
589 |
*/ |
83a763
|
590 |
public function add_row($attr = array()) |
47124c
|
591 |
{ |
T |
592 |
$this->rowindex++; |
|
593 |
$this->colindex = 0; |
|
594 |
$this->rows[$this->rowindex] = new stdClass; |
|
595 |
$this->rows[$this->rowindex]->attrib = $attr; |
|
596 |
$this->rows[$this->rowindex]->cells = array(); |
|
597 |
} |
|
598 |
|
|
599 |
|
|
600 |
/** |
|
601 |
* Build HTML output of the table data |
|
602 |
* |
|
603 |
* @param array Table attributes |
|
604 |
* @return string The final table HTML code |
|
605 |
*/ |
46290a
|
606 |
public function show($attrib = null) |
47124c
|
607 |
{ |
46290a
|
608 |
if (is_array($attrib)) |
A |
609 |
$this->attrib = array_merge($this->attrib, $attrib); |
|
610 |
|
|
611 |
$thead = $tbody = ""; |
47124c
|
612 |
|
T |
613 |
// include <thead> |
|
614 |
if (!empty($this->header)) { |
|
615 |
$rowcontent = ''; |
|
616 |
foreach ($this->header as $c => $col) { |
83a763
|
617 |
$rowcontent .= self::tag('td', $col->attrib, $col->content); |
47124c
|
618 |
} |
T |
619 |
$thead = self::tag('thead', null, self::tag('tr', null, $rowcontent)); |
|
620 |
} |
|
621 |
|
|
622 |
foreach ($this->rows as $r => $row) { |
|
623 |
$rowcontent = ''; |
|
624 |
foreach ($row->cells as $c => $col) { |
|
625 |
$rowcontent .= self::tag('td', $col->attrib, $col->content); |
|
626 |
} |
|
627 |
|
|
628 |
if ($r < $this->rowindex || count($row->cells)) { |
83a763
|
629 |
$tbody .= self::tag('tr', $row->attrib, $rowcontent); |
47124c
|
630 |
} |
T |
631 |
} |
|
632 |
|
|
633 |
if ($this->attrib['rowsonly']) { |
|
634 |
return $tbody; |
|
635 |
} |
|
636 |
|
|
637 |
// add <tbody> |
|
638 |
$this->content = $thead . self::tag('tbody', null, $tbody); |
|
639 |
|
|
640 |
unset($this->attrib['cols'], $this->attrib['rowsonly']); |
|
641 |
return parent::show(); |
|
642 |
} |
|
643 |
} |
|
644 |
|
|
645 |
?> |