X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fviews%2Fhelpers%2FSyjFormCheckbox.php;fp=application%2Fviews%2Fhelpers%2FSyjFormCheckbox.php;h=ae49370d594f1648d75f9c915a85e8b7548c4949;hb=616108d95f68d4d0c7dec334b262939782f355dc;hp=0000000000000000000000000000000000000000;hpb=fd29e7cd7bc9dd74cc4d1807c03ebd48a0deffa2;p=syj.git diff --git a/application/views/helpers/SyjFormCheckbox.php b/application/views/helpers/SyjFormCheckbox.php new file mode 100644 index 0000000..ae49370 --- /dev/null +++ b/application/views/helpers/SyjFormCheckbox.php @@ -0,0 +1,56 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, id, value, attribs, options, listsep, disable + + $checked = false; + if (isset($attribs['checked']) && $attribs['checked']) { + $checked = true; + unset($attribs['checked']); + } elseif (isset($attribs['checked'])) { + $checked = false; + unset($attribs['checked']); + } + + $checkedOptions = self::determineCheckboxInfo($value, $checked, $checkedOptions); + + // is the element disabled? + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + // XHTML or HTML end tag? + $endTag = ' />'; + if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) { + $endTag= '>'; + } + + // build the element + $xhtml = ''; + if (!$disable && !strstr($name, '[]')) { + //XXX: we have just copied Zend_View_Helper_FormCheckbox, and + // commented this line. +// $xhtml = $this->_hidden($name, $checkedOptions['uncheckedValue']); + } + $xhtml .= '_htmlAttribs($attribs) + . $endTag; + + return $xhtml; + + } +}