<?php
defined('ROOT_DIR') or die(__FILE__.' requires egConfig.inc.php');
include_once(ROOT_DIR.'egBrowser.class.php');
include_once(ROOT_DIR.'egList.class.php');
include_once(ROOT_DIR.'egPropertyPage.class.php');


// extends egList, egContainer
class egPropertyList extends egList {
	var $containersList;
	// for compatibilty with egContainer class
	var $objectsList;

	function egPropertyList($id, $title, $posX, $posY, $width, $height) {
		parent::egList($id, $title, $posX, $posY, $width, $height);
		$this->containersList = array();
		$this->objectsList = array();
	}

	function addItem(&$page) {
		$this->addListItem($page);
	}

	function isContainer() {
        return true;
  }

	function getClassName() {
        return 'egPropertyList';
  }

	function getContainerName() {
		return $this->id;
	}

  function getContainerHTML($container = null) {
		$html = "";
		return $html;
  }

	function addContainer(&$container)
	{
		if (is_object($container)) {
			$this->containersList[$container->getId()] = &$container;
		}
	}

  function getHTML($container = null) {
		$html = "var propertyList_{$this->id} = new egPropertyList('{$this->id}', '{$this->posX}', '{$this->posY}', '{$this->width}', '{$this->height}', '{$container}');";

		foreach($this->itemsList as $id => $page) {
			$html .= "propertyList_{$this->id}.addListItem('".$page->getTitle()."', '".$page->getContainer()."');";
		}

		return $html;
  }

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

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

    $stylesArray[INTERNET_EXPLORER] = array();

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

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

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


    $stylesArray[FIREFOX] = array();

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

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

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


    return $stylesArray;
  }
}
?>