1<?php
2class PreTreeFilterHeaderFooter extends PreTreeFilter {
3  var $header_html;
4  var $footer_html;
5
6  function PreTreeFilterHeaderFooter($header_html, $footer_html) {
7    $this->header_html = null;
8    $this->footer_html = null;
9
10    if (trim($header_html) != "") {
11      $this->header_html = "<body style=\"position: fixed; margin: 0; padding: 1px; width: 100%; left: 0; right: 0; bottom: 100%; text-align: center;\">".trim($header_html)."</body>";
12    };
13
14    if (trim($footer_html) != "") {
15      $this->footer_html  = "<body style=\"position: fixed; margin: 0; padding: 1px; width: 100%; left: 0; right: 0; top: 100%; text-align: center;\">".trim($footer_html)."</body>";
16    };
17  }
18
19  function process(&$tree, $data, &$pipeline) {
20    $parser = new ParserXHTML();
21
22    $null = null;
23
24    if ($this->header_html) {
25      $box =& $parser->process($this->header_html, $pipeline, $null);
26      $tree->add_child($box);
27    };
28
29    if ($this->footer_html) {
30      $box =& $parser->process($this->footer_html, $pipeline, $null);
31      $tree->add_child($box);
32    };
33  }
34}
35?>