HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/mvc/models/m_display.php
<?php

/**

	This class returns output such as listitems which are used to display data to the user.

*/

class Display extends SiteTemplate
{
	
	/**
	*
	* @var string  String containing the linkname used in the display.
	*/
	private $_linkname = URL_PAGE;
	
	/**
	*	
	* Constructor
	*/
	public function __construct()
	{
    }
	
	/* 
	
	 	GET / SET
	
	*/
	
	/**
	* Sets the linkname variable
	*
	* @access public 
	* @param int
	* @return null
	*/
	public function setLinkname($str)
	{
		if( ! empty($str))
		{	
			$this->_linkname = $str;
		}	
	}	

	/**
	* Creates an output string containing options for select
 	* Optional $value sets the current value to this $value;	 
	*
	* @param array, string, string, int/string (optional)
	* @return string
	*/
	public function createOptions($data, $keyValue, $keyLabel, $value = NULL)
	{
		$output = '<option>Geen opties gevonden.</options>';
		
		if($data != NULL)
		{			
			$output = '';
			foreach($data as $info)
			{
				$output .= '<option value="'.$info[$keyValue].'"';
                if(isset($info['id']))
                {
                    $output .= ' id="'.$info['id'].'" ';
                }

                if($value != NULL)
				{
					if($value == $info[$keyValue])
					{
						$output .= ' selected';
					}
				}
				$output .= '>
					<span class="style-option">'.$info[$keyLabel].'</span>
				</option>';
			}
		}
		return $output;
	}
}