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/Element/Checkbox.php +62 -62 1.3.81.9.2 View file →
@@ -1,62 +1,62 @@
1 -<?php
2 -class AccuaForm_Element_Checkbox extends AccuaForm_OptionElement {
3 - protected $attributes = array("type" => "checkbox");
4 - protected $inline;
5 - protected $maxheight;
6 -
7 - public function jQueryDocumentReady() {
8 - if(!empty($this->inline))
9 - echo 'jQuery("#', $this->attributes["id"], ' .pfbc-checkbox:last").css("margin-right", "0");';
10 - else
11 - echo 'jQuery("#', $this->attributes["id"], ' .pfbc-checkbox:last").css({ "padding-bottom": "0", "border-bottom": "none" });';
12 -
13 - if(!empty($this->maxheight) && is_numeric($this->maxheight)) {
14 - echo <<<JS
15 -var checkboxes = jQuery("#{$this->attributes["id"]} .pfbc-checkboxes");
16 -if(checkboxes.outerHeight() > {$this->maxheight}) {
17 - checkboxes.css({
18 - "height": "{$this->maxheight}px",
19 - "overflow": "auto",
20 - "overflow-x": "hidden"
21 - });
22 -}
23 -JS;
24 - }
25 - }
26 -
27 - public function render() {
28 - if(isset($this->attributes["value"])) {
29 - if(!is_array($this->attributes["value"]))
30 - $this->attributes["value"] = array($this->attributes["value"]);
31 - }
32 - else
33 - $this->attributes["value"] = array();
34 -
35 - if(substr($this->attributes["name"], -2) != "[]")
36 - $this->attributes["name"] .= "[]";
37 -
38 - $count = 0;
39 - echo '<div id="', $this->attributes["id"], '"><div class="pfbc-checkboxes">';
40 - foreach($this->options as $value => $text) {
41 - $value = $this->getOptionValue($value);
42 - echo '<div class="pfbc-checkbox"><input id="', $this->attributes["id"], "-", $count, '"', $this->getAttributes(array("id", "value", "checked")), ' value="', $this->filter($value), '"';
43 - if(in_array($value, $this->attributes["value"]))
44 - echo ' checked="checked"';
45 - echo '/>&nbsp;<label for="', $this->attributes["id"], "-", $count, '">', $text, '</label></div>';
46 - ++$count;
47 - }
48 - echo '</div>';
49 -
50 - if(!empty($this->inline))
51 - echo '<div style="clear: both;"></div>';
52 -
53 - echo '</div>';
54 - }
55 -
56 - public function renderCSS() {
57 - if(!empty($this->inline))
58 - echo '#', $this->attributes["id"], ' .pfbc-checkbox { float: left; margin-right: 0.5em; }';
59 - else
60 - echo '#', $this->attributes["id"], ' .pfbc-checkbox { padding: 0.5em 0; border-bottom: 1px solid #f4f4f4; }';
61 - }
62 -}
1 +<?php
2 +class AccuaForm_Element_Checkbox extends AccuaForm_OptionElement {
3 + protected $attributes = array("type" => "checkbox");
4 + protected $inline;
5 + protected $maxheight;
6 +
7 + public function jQueryDocumentReady() {
8 + if(!empty($this->inline))
9 + echo 'jQuery("#', $this->attributes["id"], ' .pfbc-checkbox:last").css("margin-right", "0");';
10 + else
11 + echo 'jQuery("#', $this->attributes["id"], ' .pfbc-checkbox:last").css({ "padding-bottom": "0", "border-bottom": "none" });';
12 +
13 + if(!empty($this->maxheight) && is_numeric($this->maxheight)) {
14 + echo <<<JS
15 +var checkboxes = jQuery("#{$this->attributes["id"]} .pfbc-checkboxes");
16 +if(checkboxes.outerHeight() > {$this->maxheight}) {
17 + checkboxes.css({
18 + "height": "{$this->maxheight}px",
19 + "overflow": "auto",
20 + "overflow-x": "hidden"
21 + });
22 +}
23 +JS;
24 + }
25 + }
26 +
27 + public function render() {
28 + if(isset($this->attributes["value"])) {
29 + if(!is_array($this->attributes["value"]))
30 + $this->attributes["value"] = array($this->attributes["value"]);
31 + }
32 + else
33 + $this->attributes["value"] = array();
34 +
35 + if(substr($this->attributes["name"], -2) != "[]")
36 + $this->attributes["name"] .= "[]";
37 +
38 + $count = 0;
39 + echo '<div id="', $this->attributes["id"], '"><div class="pfbc-checkboxes">';
40 + foreach($this->options as $value => $text) {
41 + $value = $this->getOptionValue($value);
42 + echo '<div class="pfbc-checkbox"><input id="', $this->attributes["id"], "-", $count, '"', $this->getAttributes(array("id", "value", "checked")), ' value="', $this->filter($value), '"';
43 + if(in_array($value, $this->attributes["value"]))
44 + echo ' checked="checked"';
45 + echo '/>&nbsp;<label for="', $this->attributes["id"], "-", $count, '">', $text, '</label></div>';
46 + ++$count;
47 + }
48 + echo '</div>';
49 +
50 + if(!empty($this->inline))
51 + echo '<div style="clear: both;"></div>';
52 +
53 + echo '</div>';
54 + }
55 +
56 + public function renderCSS() {
57 + if(!empty($this->inline))
58 + echo '#', $this->attributes["id"], ' .pfbc-checkbox { float: left; margin-right: 0.5em; }';
59 + else
60 + echo '#', $this->attributes["id"], ' .pfbc-checkbox { padding: 0.5em 0; border-bottom: 1px solid #f4f4f4; }';
61 + }
62 +}