XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
formbutton.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
21 
23 
42 class XoopsFormButton extends XoopsFormElement
43 {
44 
50  var $_value;
51 
57  var $_type;
58 
67  function XoopsFormButton($caption, $name, $value = "", $type = "button")
68  {
69  $this->setCaption($caption);
70  $this->setName($name);
71  $this->_type = $type;
72  $this->setValue($value);
73  }
74 
81  function getValue($encode = false)
82  {
83  return $encode ? htmlspecialchars($this->_value, ENT_QUOTES) : $this->_value;
84  }
85 
91  function setValue($value)
92  {
93  $this->_value = $value;
94  }
95 
101  function getType()
102  {
103  return in_array( strtolower($this->_type), array("button", "submit", "reset") ) ? $this->_type : "button";
104  }
105 
111  function render()
112  {
113  return "<input type='" . $this->getType() . "' class='formButton' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "' title='" . $this->getValue() . "'" . $this->getExtra() . " />";
114  }
115 }
116 ?>