# shiftcontroller/4.9.85/hc3/ui/element/input/checkboxset.php

ShiftController Employee Shift Scheduling, version 4.9.85. 36 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/hc3/ui/element/input/checkboxset.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/raw/hc3/ui/element/input/checkboxset.php
- Modified: 2018-04-25T09:41:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/hc3/ui/element/input/checkboxset.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
class HC3_Ui_Element_Input_CheckboxSet extends HC3_Ui_Abstract_Input
{
	protected $el = 'input';
	protected $uiType = 'input/checkbox';

	protected $options = array();

	public function __construct( $htmlFactory, $name, $label = NULL, $options = array(), $value = array() )
	{
		parent::__construct( $htmlFactory, $name, $label, $value );
		$this->options = $options;
	}

	public function render()
	{
		$options = array();
		foreach( $this->options as $k => $v ){
			if( ! strlen($k) ){
				$k = ' ';
			}
			$checked = in_array($k, $this->value) ? TRUE : FALSE;
			$name = $this->name . '[]';
			$thisInput =  $this->htmlFactory->makeInputCheckbox( $name, $v, $k, $checked );
			$options[] =  $thisInput;
		}

		$out = $this->htmlFactory->makeListInline( $options );

		if( strlen($this->label) ){
			$out = $this->htmlFactory->makeLabelled( $this->label, $out, $this->htmlId() );
		}

		return $out;
	}
}
```
