1: <?php
2: /**
3: * Encapsulates a fieldset, which has a legend that acts as a label. HTML5 defines a new Name element, which
4: * is not yet supported in IE of this writing, but other browsers support it. So, if its defined, we will output
5: * it in the html, but it will not affect what appears on the screen unless you draw the Name too.
6: *
7: * @package Controls\Base
8: *
9: * @property string $Legend is the legend that will be output for the fieldset.
10: */
11:
12: class QFieldset extends QBlockControl {
13: /** @var string HTML tag to the used for the Block Control */
14: protected $strTagName = 'fieldset';
15: /** @var string Default display style for the control. See QDisplayStyle class for available list */
16: protected $strDefaultDisplayStyle = QDisplayStyle::Block;
17: /** @var bool Is the control a block element? */
18: protected $blnIsBlockElement = true;
19: /** @var bool Use htmlentities for the control? */
20: protected $blnHtmlEntities = false;
21: /** @var string legend */
22: protected $strLegend;
23:
24: /**
25: * We will output style tags and such, but fieldset styling is not well supported across browsers.
26: */
27: protected function GetInnerHtml() {
28: $strHtml = parent::GetInnerHtml();
29:
30: if (!empty($this->strLegend)) {
31: $strHtml = '<legend>' . $this->strLegend . '</legend>' . _nl() . $strHtml;
32: }
33:
34: return $strHtml;
35: }
36:
37: /////////////////////////
38: // Public Properties: GET
39: /////////////////////////
40: public function __get($strName) {
41: switch ($strName) {
42: // APPEARANCE
43: case "Legend": return $this->strLegend;
44:
45: default:
46: try {
47: return parent::__get($strName);
48: } catch (QCallerException $objExc) {
49: $objExc->IncrementOffset();
50: throw $objExc;
51: }
52: }
53: }
54:
55: /////////////////////////
56: // Public Properties: SET
57: /////////////////////////
58: public function __set($strName, $mixValue) {
59: $this->blnModified = true;
60:
61: switch ($strName) {
62: // APPEARANCE
63: case "Legend":
64: try {
65: $this->strLegend = QType::Cast($mixValue, QType::String);
66: break;
67: } catch (QInvalidCastException $objExc) {
68: $objExc->IncrementOffset();
69: throw $objExc;
70: }
71:
72: default:
73: try {
74: parent::__set($strName, $mixValue);
75: } catch (QCallerException $objExc) {
76: $objExc->IncrementOffset();
77: throw $objExc;
78: }
79: break;
80: }
81: }
82:
83:
84: }