Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// $Header: /cvsroot/html2ps/box.input.text.php,v 1.28 2007/01/03 19:39:29 Konstantin Exp $
3
 
4
/// define('SIZE_SPACE_KOEFF',1.65); (defined in tag.input.inc.php)
5
 
6
class TextInputBox extends InlineControlBox {
7
  /**
8
   * @var String contains the default value of this text field
9
   * @access private
10
   */
11
  var $_value;
12
 
13
  function TextInputBox($value, $name) {
14
    $this->InlineControlBox();
15
 
16
    $this->_value = $value;
17
    $this->_field_name = $name;
18
  }
19
 
20
  function &create(&$root, &$pipeline) {
21
    // Text to be displayed
22
    if ($root->has_attribute('value')) {
23
      $text = trim($root->get_attribute('value'));
24
    } else {
25
      $text = '';
26
    };
27
 
28
    /**
29
     * Input field name
30
     */
31
    $name = $root->get_attribute('name');
32
 
33
    $box =& new TextInputBox($root->get_attribute("value"), $name);
34
    $box->readCSS($pipeline->get_current_css_state());
35
    $box->setup_content($text, $pipeline);
36
 
37
    return $box;
38
  }
39
 
40
  function get_height() {
41
    $normal_height = parent::get_height();
42
 
43
    $hc = $this->get_height_constraint();
44
    if ($hc->is_null()) {
45
      return $normal_height;
46
    } else {
47
      return $normal_height - $this->_get_vert_extra();
48
    };
49
  }
50
 
51
  function show(&$driver) {
52
    // Now set the baseline of a button box to align it vertically when flowing isude the
53
    // text line
54
 
55
    $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
56
    $this->baseline         = $this->content[0]->baseline + $this->get_extra_top();
57
 
58
    /**
59
     * If we're rendering the interactive form, the field content should not be rendered
60
     */
61
    global $g_config;
62
    if ($g_config['renderforms']) {
63
      /**
64
       * Render background/borders only
65
       */
66
      $status = GenericFormattedBox::show($driver);
67
 
68
      /**
69
       * @todo encoding name?
70
       * @todo font name?
71
       * @todo check if font is embedded for PDFLIB
72
       */
73
      $driver->field_text($this->get_left_padding(),
74
                          $this->get_top_padding(),
75
                          $this->get_width()  + $this->get_padding_left() + $this->get_padding_right(),
76
                          $this->get_height(),
77
                          $this->_value,
78
                          $this->_field_name);
79
    } else {
80
      /**
81
       * Render everything, including content
82
       */
83
      $status = GenericContainerBox::show($driver);
84
    }
85
 
86
    return $status;
87
  }
88
}
89
?>