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
contact-forms / PFBC / View / Horizontal.php

Horizontal.php in Contact Forms by Cimatti 1.9.2, at PFBC/View/Horizontal.php

53 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class View_Horizontal extends View {
3 protected $labelPaddingTop;
4
5 public function jQueryDocumentReady() {
6 $id = $this->form->getId();
7 echo 'jQuery("#', $id, ' .pfbc-element:last").css("margin-right", "0");';
8 }
9
10 public function render() {
11 echo '<form', $this->form->getAttributes(), '>';
12 $this->form->getError()->render();
13
14 $elements = $this->form->getElements();
15 $elementSize = sizeof($elements);
16 for($e = 0; $e < $elementSize; ++$e) {
17 $element = $elements[$e];
18
19 if($element instanceof Element_Hidden || $element instanceof Element_HTMLExternal)
20 $element->render();
21 else {
22 echo '<div class="pfbc-element">', $element->getPreHTML();
23 if(!$element instanceof Element_Button)
24 $this->renderLabel($element);
25 $element->render();
26 echo $element->getPostHTML(), '</div>';
27 }
28 }
29
30 echo '<div style="clear: both;"></div></form>';
31 }
32
33 public function renderCSS() {
34 $id = $this->form->getId();
35
36 parent::renderCSS();
37 echo <<<CSS
38 #$id .pfbc-element { float: left; margin-right: .5em; }
39 #$id .pfbc-label strong { color: #990000; }
40 #$id .pfbc-label { float: left; margin-right: .25em; }
41 CSS;
42
43 if(empty($this->labelPaddingTop) && !in_array("style", $this->form->getPrevent()))
44 $this->labelPaddingTop = ".75em";
45
46 if(!empty($this->labelPaddingTop)) {
47 if(is_numeric($this->labelPaddingTop))
48 $this->labelPaddingTop .= "px";
49 echo '#', $id, ' .pfbc-label { padding-top: ', $this->labelPaddingTop, '; }';
50 }
51 }
52 }
53