PluginProbe
Contact Forms by Cimatti / 1.1
Contact Forms by Cimatti v1.1
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 / classes / Element / Radio.php

Radio.php in Contact Forms by Cimatti 1.1, at classes/Element/Radio.php

54 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class AccuaForm_Element_Radio extends AccuaForm_OptionElement {
3 protected $attributes = array("type" => "radio");
4 protected $inline;
5 protected $maxheight;
6
7 public function jQueryDocumentReady() {
8 if(!empty($this->inline))
9 echo 'jQuery("#', $this->attributes["id"], ' .pfbc-radio:last").css("margin-right", "0");';
10 else
11 echo 'jQuery("#', $this->attributes["id"], ' .pfbc-radio:last").css({ "padding-bottom": "0", "border-bottom": "none" });';
12
13 if(!empty($this->maxheight) && is_numeric($this->maxheight)) {
14 echo <<<JS
15 var radiobuttons = jQuery("#{$this->attributes["id"]} .pfbc-radio-buttons");
16 if(radiobuttons.outerHeight() > {$this->maxheight}) {
17 radiobuttons.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 $count = 0;
29 $checked = false;
30 echo '<div id="', $this->attributes["id"], '"><div class="pfbc-radio-buttons">';
31 foreach($this->options as $value => $text) {
32 $value = $this->getOptionValue($value);
33 echo '<div class="pfbc-radio"><input id="', $this->attributes["id"], "-", $count, '"', $this->getAttributes(array("id", "value", "checked")), ' value="', $this->filter($value), '"';
34 if(isset($this->attributes["value"]) && $this->attributes["value"] == $value)
35 echo ' checked="checked"';
36 echo '/>&nbsp;<label for="', $this->attributes["id"], "-", $count, '">', $text, '</label></div>';
37 ++$count;
38 }
39 echo '</div>';
40
41 if(!empty($this->inline))
42 echo '<div style="clear: both;"></div>';
43
44 echo '</div>';
45 }
46
47 public function renderCSS() {
48 if(!empty($this->inline))
49 echo '#', $this->attributes["id"], ' .pfbc-radio { float: left; margin-right: 0.5em; }';
50 else
51 echo '#', $this->attributes["id"], ' .pfbc-radio { padding: 0.5em 0; border-bottom: 1px solid #f4f4f4; }';
52 }
53 }
54