XOOPS  2.6.0
Button.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Form;
13 
25 class Button extends Element
26 {
27 
36  public function __construct($caption, $name, $value = "", $type = "button")
37  {
38  $this->setCaption($caption);
39  $this->setAttribute('type', $type);
40  $this->setAttribute('name', $name);
41  $this->setValue($value);
42  }
43 
49  public function getType()
50  {
51  return (string) $this->getAttribute('type');
52  //return in_array(strtolower($this->type), array("button", "submit", "reset")) ? $this->type : "button";
53  }
54 
60  public function render()
61  {
62  $this->addAttribute('class', 'btn');
63 
65  return '<input ' . $attributes . 'value="' . $this->getValue()
66  . '" ' . $this->getExtra() .' >';
67  }
68 }
setValue($value)
Definition: Element.php:199
getValue($encode=false)
Definition: Element.php:180
setCaption($caption)
Definition: Element.php:396
setAttribute($name, $value=null)
Definition: Attributes.php:42
getExtra($encode=false)
Definition: Element.php:539
__construct($caption, $name, $value="", $type="button")
Definition: Button.php:36
addAttribute($name, $value)
Definition: Attributes.php:117
$type
Definition: misc.php:33