FormMultiCheckbox.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_View
  17. * @subpackage Helper
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /** Zend_View_Helper_FormRadio */
  22. require_once 'Zend/View/Helper/FormRadio.php';
  23. /**
  24. * Helper to generate a set of checkbox button elements
  25. *
  26. * @category Zend
  27. * @package Zend_View
  28. * @subpackage Helper
  29. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_View_Helper_FormMultiCheckbox extends Zend_View_Helper_FormRadio
  33. {
  34. /**
  35. * Input type to use
  36. * @var string
  37. */
  38. protected $_inputType = 'checkbox';
  39. /**
  40. * Whether or not this element represents an array collection by default
  41. * @var bool
  42. */
  43. protected $_isArray = true;
  44. /**
  45. * Generates a set of checkbox button elements.
  46. *
  47. * @access public
  48. *
  49. * @param string|array $name If a string, the element name. If an
  50. * array, all other parameters are ignored, and the array elements
  51. * are extracted in place of added parameters.
  52. *
  53. * @param mixed $value The checkbox value to mark as 'checked'.
  54. *
  55. * @param array $options An array of key-value pairs where the array
  56. * key is the checkbox value, and the array value is the radio text.
  57. *
  58. * @param array|string $attribs Attributes added to each radio.
  59. *
  60. * @return string The radio buttons XHTML.
  61. */
  62. public function formMultiCheckbox($name, $value = null, $attribs = null,
  63. $options = null, $listsep = "<br />\n")
  64. {
  65. return $this->formRadio($name, $value, $attribs, $options, $listsep);
  66. }
  67. }