# shiftcontroller/4.9.66/hc3/ui/element/list.php

ShiftController Employee Shift Scheduling, version 4.9.66. 69 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.66/code/hc3/ui/element/list.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.66/raw/hc3/ui/element/list.php
- Modified: 2024-04-18T17:29:38+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.66/code/hc3/ui/element/list.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
class HC3_Ui_Element_List extends HC3_Ui_Abstract_Collection
{
	protected $htmlFactory = NULL;
	protected $striped = FALSE;

	public function __construct( 
		HC3_Ui $htmlFactory,
		array $items = array()
		)
	{
		$this->htmlFactory = $htmlFactory;
		parent::__construct( $items );
	}

	public function setStriped( $striped = TRUE )
	{
		$this->striped = $striped;
		return $this;
	}

	public function render()
	{
		$out = NULL;

	// content
		$children = '';
		$rri = 0;
		foreach( $this->children as $child ){
			$child = '' . $child;
			if( ! strlen($child) ){
				continue;
			}

			$child = $this->htmlFactory->makeBlock( $child );
			if( $this->gutter && $rri && (! $this->striped) ){
				$child->addAttr('class', 'hc-mt' . $this->gutter);
			}
			$rri++;

			if( $this->striped ){
				$child->addAttr('class', 'hc-p' . $this->gutter);
				if( defined('WPINC') ){
					if( is_admin() ){
						if( $rri % 2 ){
							$child->addAttr('class', 'hc-bg-wpsilver');
						}
						else {
							$child->addAttr('class', 'hc-bg-white');
						}
					}
				}
				else {
					if( $rri % 2 ){
						$child->addAttr('class', 'hc-bg-lightsilver');
					}
				}
			}

			$children .= '' . $child;
		}

		if( strlen($children) ){
			$out = $this->htmlFactory->makeBlock( $children );
		}

		return $out;
	}
}
```
