2 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3 and is published under the AGPL license. */
5 require_once 'Zend/View/Helper/FormCheckbox.php';
7 class Syj_View_Helper_SyjFormCheckbox extends Zend_View_Helper_FormCheckbox
9 public function SyjFormCheckbox($name, $value = null, $attribs = null, array $checkedOptions = null)
11 $info = $this->_getInfo($name, $value, $attribs);
12 extract($info); // name, id, value, attribs, options, listsep, disable
15 if (isset($attribs['checked']) && $attribs['checked']) {
17 unset($attribs['checked']);
18 } elseif (isset($attribs['checked'])) {
20 unset($attribs['checked']);
23 $checkedOptions = self::determineCheckboxInfo($value, $checked, $checkedOptions);
25 // is the element disabled?
28 $disabled = ' disabled="disabled"';
31 // XHTML or HTML end tag?
33 if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) {
39 if (!$disable && !strstr($name, '[]')) {
40 //XXX: we have just copied Zend_View_Helper_FormCheckbox, and
41 // commented this line.
42 // $xhtml = $this->_hidden($name, $checkedOptions['uncheckedValue']);
44 $xhtml .= '<input type="checkbox"'
45 . ' name="' . $this->view->escape($name) . '"'
46 . ' id="' . $this->view->escape($id) . '"'
47 . ' value="' . $this->view->escape($checkedOptions['checkedValue']) . '"'
48 . $checkedOptions['checkedString']
50 . $this->_htmlAttribs($attribs)