PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
← All changes | classes/View/SideBySide.php +84 -84 1.3.61.9.2 View file →
@@ -1,84 +1,84 @@
1 -<?php
2 -class AccuaForm_View_SideBySide extends AccuaForm_View_Standard {
3 - protected $labelWidth;
4 - protected $labelRightAlign;
5 - protected $labelPaddingRight = 5;
6 - protected $labelPaddingTop;
7 -
8 - public function __construct($labelWidth, array $properties = null) {
9 - if(!empty($properties))
10 - $properties["labelWidth"] = $labelWidth;
11 - else
12 - $properties = array("labelWidth" => $labelWidth);
13 -
14 - parent::__construct($properties);
15 - }
16 -
17 - public function renderCSS() {
18 - $id = $this->form->getId();
19 - $width = $this->form->getWidth();
20 - $widthSuffix = $this->form->getWidthSuffix();
21 - $elementWidth = $width - $this->labelWidth - $this->labelPaddingRight;
22 - $this->form->renderCSS();
23 - /*
24 - View::renderCSS();
25 - echo <<<CSS
26 -#$id { width: $width{$widthSuffix}; }
27 -#$id .pfbc-element { margin-bottom: 0.6em; }
28 -#$id .pfbc-elementbottom { clear: both; }
29 -#$id .pfbc-label { width: {$this->labelWidth}$widthSuffix; float: left; padding-right: {$this->labelPaddingRight}$widthSuffix; }
30 -#$id .pfbc-buttons { text-align: right; }
31 -#$id .pfbc-textbox, #$id .pfbc-textarea, #$id .pfbc-select { width: 98% !important; display:block; border: 1px solid #ccc; padding:2px; }
32 -#$id .pfbc-fieldwrap { width: $elementWidth{$widthSuffix}; display: inline-block; }
33 -CSS;
34 -
35 - if(!empty($this->labelRightAlign))
36 - echo '#', $id, ' .pfbc-label { text-align: right; }';
37 -
38 - if(empty($this->labelPaddingTop) && !in_array("style", $this->form->getPrevent()))
39 - $this->labelPaddingTop = ".75em";
40 -
41 - if(!empty($this->labelPaddingTop)) {
42 - if(is_numeric($this->labelPaddingTop))
43 - $this->labelPaddingTop .= "px";
44 - echo '#', $id, ' .pfbc-label { padding-top: ', $this->labelPaddingTop, '; }';
45 - }
46 -
47 - $elements = $this->form->getElements();
48 - $elementSize = sizeof($elements);
49 - $elementCount = 0;
50 - foreach ($elements as $element) {
51 - $elementWidth = $element->getWidth();
52 - if(!$element instanceof Element_Hidden && !$element instanceof Element_HTMLExternal && !$element instanceof Element_HTMLExternal) {
53 - if(!empty($elementWidth)) {
54 - echo '#', $id, ' .pfbc-element-', $elementCount, ' { width: ', $elementWidth, $widthSuffix, '; }';
55 - if($widthSuffix == "px") {
56 - $elementWidth = $elementWidth - $this->labelWidth - $this->labelPaddingRight;
57 - echo '#', $id, ' .pfbc-element-', $elementCount, ' .pfbc-textbox, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-textarea, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-select, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-right { width: ', $elementWidth, $widthSuffix, '; }';
58 - }
59 - }
60 - $elementCount++;
61 - }
62 - } */
63 - }
64 -
65 - /*This method encapsulates the various pieces that are included in an element's label.*/
66 - protected function renderLabel($element) {
67 - $label = $element->getLabel();
68 - $id = $element->getID();
69 - $description = $element->getDescription();
70 - if(!empty($label) || !empty($description)) {
71 - echo '<div class="pfbc-label">';
72 - if(!empty($label)) {
73 - echo '<label for="', $id, '">', $label;
74 - if($element->isRequired())
75 - echo ' <strong>*</strong>';
76 - echo '</label>';
77 - }
78 - if(!empty($description))
79 - echo '<em>', $description, '</em>';
80 - echo '</div>';
81 - }
82 - }
83 -
84 -}
1 +<?php
2 +class AccuaForm_View_SideBySide extends AccuaForm_View_Standard {
3 + protected $labelWidth;
4 + protected $labelRightAlign;
5 + protected $labelPaddingRight = 5;
6 + protected $labelPaddingTop;
7 +
8 + public function __construct($labelWidth, array $properties = null) {
9 + if(!empty($properties))
10 + $properties["labelWidth"] = $labelWidth;
11 + else
12 + $properties = array("labelWidth" => $labelWidth);
13 +
14 + parent::__construct($properties);
15 + }
16 +
17 + public function renderCSS() {
18 + $id = $this->form->getId();
19 + $width = $this->form->getWidth();
20 + $widthSuffix = $this->form->getWidthSuffix();
21 + $elementWidth = $width - $this->labelWidth - $this->labelPaddingRight;
22 + $this->form->renderCSS();
23 + /*
24 + View::renderCSS();
25 + echo <<<CSS
26 +#$id { width: $width{$widthSuffix}; }
27 +#$id .pfbc-element { margin-bottom: 0.6em; }
28 +#$id .pfbc-elementbottom { clear: both; }
29 +#$id .pfbc-label { width: {$this->labelWidth}$widthSuffix; float: left; padding-right: {$this->labelPaddingRight}$widthSuffix; }
30 +#$id .pfbc-buttons { text-align: right; }
31 +#$id .pfbc-textbox, #$id .pfbc-textarea, #$id .pfbc-select { width: 98% !important; display:block; border: 1px solid #ccc; padding:2px; }
32 +#$id .pfbc-fieldwrap { width: $elementWidth{$widthSuffix}; display: inline-block; }
33 +CSS;
34 +
35 + if(!empty($this->labelRightAlign))
36 + echo '#', $id, ' .pfbc-label { text-align: right; }';
37 +
38 + if(empty($this->labelPaddingTop) && !in_array("style", $this->form->getPrevent()))
39 + $this->labelPaddingTop = ".75em";
40 +
41 + if(!empty($this->labelPaddingTop)) {
42 + if(is_numeric($this->labelPaddingTop))
43 + $this->labelPaddingTop .= "px";
44 + echo '#', $id, ' .pfbc-label { padding-top: ', $this->labelPaddingTop, '; }';
45 + }
46 +
47 + $elements = $this->form->getElements();
48 + $elementSize = sizeof($elements);
49 + $elementCount = 0;
50 + foreach ($elements as $element) {
51 + $elementWidth = $element->getWidth();
52 + if(!$element instanceof Element_Hidden && !$element instanceof Element_HTMLExternal && !$element instanceof Element_HTMLExternal) {
53 + if(!empty($elementWidth)) {
54 + echo '#', $id, ' .pfbc-element-', $elementCount, ' { width: ', $elementWidth, $widthSuffix, '; }';
55 + if($widthSuffix == "px") {
56 + $elementWidth = $elementWidth - $this->labelWidth - $this->labelPaddingRight;
57 + echo '#', $id, ' .pfbc-element-', $elementCount, ' .pfbc-textbox, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-textarea, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-select, #', $id, ' .pfbc-element-', $elementCount, ' .pfbc-right { width: ', $elementWidth, $widthSuffix, '; }';
58 + }
59 + }
60 + $elementCount++;
61 + }
62 + } */
63 + }
64 +
65 + /*This method encapsulates the various pieces that are included in an element's label.*/
66 + protected function renderLabel($element) {
67 + $label = $element->getLabel();
68 + $id = $element->getID();
69 + $description = $element->getDescription();
70 + if(!empty($label) || !empty($description)) {
71 + echo '<div class="pfbc-label">';
72 + if(!empty($label)) {
73 + echo '<label for="', $id, '">', $label;
74 + if($element->isRequired())
75 + echo ' <strong>*</strong>';
76 + echo '</label>';
77 + }
78 + if(!empty($description))
79 + echo '<em>', $description, '</em>';
80 + echo '</div>';
81 + }
82 + }
83 +
84 +}