Location: PHPKode > scripts > True Color Picker 2 > class.EzyColorPicker.php
<?php
/***
Ezy Color Picker: Stand Alone Version
Uses: True Color Picker 2
***/
class EzyColorPicker{
	private $htmlName;
	private $cssId;
	private $cssClass;
	private $buttonContent;
	private $buttonIsImage;
	private $path;
	private $isReadOnly;
	private $top;
	private $left;	
	
	function EzyColorPicker($htmlName){
	 	$this->htmlName = $htmlName;
		$this->top = 1;
		$this->left = 1;		
	}
	function setHtmlName($value){
		$this->htmlName = $value;
	}
	function getHtmlName(){
		return $this->htmlName;
	}
	function setHtmld($value){
		$this->htmlId = $value;
	}
	function getHtmlId(){
		return $this->htmlId;
	}
	function setCssClass($value){
		$this->cssClass = $value;
	}
	function getCssClass(){
		return $this->cssClass;
	}
	function setButtonContent($value){
		$this->buttonContent = $value;
	}
	function getButtonContent(){
		return $this->buttonContent;
	}
	function setButtonIsImage($value){
		$this->buttonIsImage = $value;
	}
	function getButtonIsImage(){
		return $this->buttonIsImage;
	}
	/* Path from the calling page to TrueColorPicker Directory */
	function setPath($value){
		$this->path = $value;
	}
	function getPath(){
		return $this->path;
	}
	function setIsReadOnly($value){
		$this->isReadOnly = $value;
	}
	function getIsReadOnly(){
		return $this->isReadOnly;
	}
	function setPosition($top, $left){
	
		$this->top = $top;
		$this->left = $left;
	}
	function textbox(){
		$htmlId = (!empty($this->htmlId))?$this->htmlId:$this->htmlName;
		ob_start(); ?><input type="text" name="<?=$this->htmlName?>" id="<?=$htmlId?>" class="<?=$this->cssClass?>" size="6" maxlength="6" 
            <? if($this->isReadOnly){ ?>
			readonly="readonly"
            <? } ?>
            >
			<input type="hidden" id="<?=$htmlId?>_lastBc" value='' />
			<input type="hidden" id="<?=$htmlId?>_lastArrowPosition" value='' />
			<input type="hidden" id="<?=$htmlId?>_lastCLeft" value='' />
			<input type="hidden" id="<?=$htmlId?>_lastCTop" value='' /><?	$html = ob_get_clean();
			return $html;	
	}
	
	function button(){
		$htmlId = (!empty($this->htmlId))?$this->htmlId:$this->htmlName;
		ob_start(); ?><button type="button" onClick="popColorPicker('<?=$htmlId?>','<?=$this->path?>','<?=$this->top?>','<?=$this->left?>')" id="<?=$htmlId?>_button" class="<?=$this->cssClass?>_button"><? if($this->buttonIsImage){ ?><img src="<?=$this->buttonContent?>" />
			<? }else{ 
				echo $this->buttonContent;
			} ?></button><?	$html = ob_get_clean();
			return $html;
	}
	function html(){
		return $this->textbox().$this->button();
	}
}
?>
Return current item: True Color Picker 2