Source for file Checkbox.php
Documentation is available at Checkbox.php
* A Framework for Creating and Using Complex Web Elements
* The purpose of this framework is to provide a library of high-level objects
* to facilitate common HTML coding tasks, such as menus, tables, and forms.
* The intent is to reduce repetitive HTML coding as much as possible, replacing
* it with a combination of configuration files and style sheets with
* standardized naming conventions.
* This framework is built on and requires the
* {@link http://framework.zend.com/ Zend Framework}.
* @author Lyle Frost <lfrost@cnz.com>
* @copyright Copyright (c) 2006-2007 Citadel Network <{@link http://www.citadelnetwork.com/}>
* @license http://www.citadelnetwork.com/license/cnzframework New BSD License
* @version $Id: Checkbox.php 27 2007-07-19 18:47:54Z lfrost $
Zend_Loader::loadClass('Cnz_Html_Form_Item');
* HTML Form Checkbox class
* This class automates the creation and display of a checkbox.
* Example INI (defaults shown as comments):
* item.is_active.label = Active
* item.is_active.type = checkbox
* ;item.is_active.value = true
/** Value to use when checked. */
/*====================================================================*/
* value Value when checked
* @param array $options Options
* @param Zend_Config $config Configuration
public function __construct(array $options = array(), Zend_Config $config = NULL)
if (isset ($config->value)) $this->value = $config->value;
* @param string $style Value for outermost style attribute
public function display($style = NULL)
echo $indent, '<div class = "', $this->genStyles('label'), '">' . ' ' . '</div>', "\n";
echo $indent, '<div class = "', $this->genStyles('field'), '">';
echo ' checked = "checked"';
echo ' id = "', $this->genId(), '" name = "', $this->name, '" type = "checkbox"';
if (!empty($this->value)) echo ' value = "', $this->value, '"';
echo '<label for = "', $this->genId(), '">', $this->label, '</label>';
|