1: <?php
2: /**
3: * XOOPS Form Class Elements
4: *
5: * @copyright (c) 2000-2017 XOOPS Project (www.xoops.org)
6: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
7: * @package kernel
8: * @subpackage form
9: * @since 2.4.0
10: * @author John Neill <catzwolf@xoops.org>
11: *
12: */
13: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
14:
15: /**
16: * XoopsFormButtonTray
17: *
18: * @author John Neill <catzwolf@xoops.org>
19: * @package kernel
20: * @subpackage form
21: * @access public
22: */
23: class XoopsFormButtonTray extends XoopsFormElement
24: {
25: /**
26: * Value
27: *
28: * @var string
29: * @access private
30: */
31: public $_value;
32:
33: /**
34: * Type of the button. This could be either "button", "submit", or "reset"
35: *
36: * @var string
37: * @access private
38: */
39: public $_type;
40:
41: public $_showDelete;
42:
43: /**
44: * Constructor
45: *
46: * @param mixed $name
47: * @param string $value
48: * @param string $type
49: * @param string $onclick
50: * @param bool $showDelete
51: */
52: public function __construct($name, $value = '', $type = '', $onclick = '', $showDelete = false)
53: {
54: $this->setName($name);
55: $this->setValue($value);
56: $this->_type = (!empty($type)) ? $type : 'submit';
57: $this->_showDelete = $showDelete;
58: if ($onclick) {
59: $this->setExtra($onclick);
60: } else {
61: $this->setExtra('');
62: }
63: }
64:
65: /**
66: * XoopsFormButtonTray::getValue()
67: *
68: * @return string
69: */
70: public function getValue()
71: {
72: return $this->_value;
73: }
74:
75: /**
76: * XoopsFormButtonTray::setValue()
77: *
78: * @param mixed $value
79: *
80: * @return void
81: */
82: public function setValue($value)
83: {
84: $this->_value = $value;
85: }
86:
87: /**
88: * XoopsFormButtonTray::getType()
89: *
90: * @return string
91: */
92: public function getType()
93: {
94: return $this->_type;
95: }
96:
97: /**
98: * XoopsFormButtonTray::render()
99: *
100: * @return string|void
101: */
102: public function render()
103: {
104: return XoopsFormRenderer::getInstance()->get()->renderFormButtonTray($this);
105: }
106: }
107: