<?php
defined('ROOT_DIR') or die(__FILE__.' requires egConfig.inc.php');

include_once(ROOT_DIR.'egButton.class.php');

class egCheckBox extends egButton {
	var $name;
	var $value;
	var $checked;
	var $siblingsList;
	var $multipleSelection;
	
	function egCheckBox($id, $title, $posX = 0, $posY = 0, $width = 0, $height = 0, $name = "", $value = '', $checked = false, $multipleSelection = true) {
		parent::egButton($id, $title, $posX, $posY, $width, $height, null, null);
		$this->name = $name;
		$this->value = $value;
		$this->checked = $checked;
		$this->siblingsList = array();
		$this->multipleSelection = $multipleSelection;
	}

	function getClassName() {
		return "egCheckBox";
	}

	function hasMultipleSelection() {
	  return $this->multipleSelection;
	}

	function getSiblingsList() {
	  return $this->siblingsList;
	}
	
	function getHTML($container = null) {
		$html = "var checkBox_{$this->id} = new egCheckBox('{$this->id}', '{$this->title}', '{$this->posX}', '{$this->posY}', '{$this->width}', '{$this->height}', '{$container}', '{$this->name}', '{$this->value}', '{$this->checked}');";
		if($this->checked) {
		  $html .= "checkBox_{$this->id}.setChecked();";
		}
		$html .= "egObjectsArray['checkBox_{$this->id}'] = checkBox_{$this->id};";

		return $html;
	}

    /**
    *
    * @static
    */
	function getScriptsFiles() {
    $scriptsArray = array();
    $scriptsArray[ALL] = "egCheckBox_default.js";
    return $scriptsArray;
	}

    /**
    *
    * @static
    */
	function getStylesFiles() {
    $stylesArray = array();
    $stylesArray[ALL] = "egCheckBox_default.css";

    $stylesArray[INTERNET_EXPLORER] = array();

    $stylesArray[INTERNET_EXPLORER][ALL] = "egCheckBox_default.css";

    $stylesArray[INTERNET_EXPLORER]['6'] = array();
    $stylesArray[INTERNET_EXPLORER]['6'][ALL] = "egCheckBox_default.css";

    $stylesArray[INTERNET_EXPLORER]['7'] = array();
    $stylesArray[INTERNET_EXPLORER]['7'][ALL] = "egCheckBox_default.css";


    $stylesArray[FIREFOX] = array();

    $stylesArray[FIREFOX][ALL] = "egCheckBox_default.css";

    $stylesArray[FIREFOX]['1'] = array();
    $stylesArray[FIREFOX]['1'][ALL] = "egCheckBox_default.css";
    $stylesArray[FIREFOX]['1']['5'] = "egCheckBox_default.css";

    $stylesArray[FIREFOX]['2'] = array();
    $stylesArray[FIREFOX]['2'][ALL] = "egCheckBox_default.css";


    return $stylesArray;
  }
}
?>
