<?php
	require_once( $GLOBALS["site_root"] . "/includes/widgets/Widget.inc.php" );

	class AdminTristate extends Widget {
		protected $sTitle ="";
		protected $bShowTitle = false;
		protected $sValue = "";
		
		public function setTitle( $v ) { $this->sTitle = $v; }
		public function setShowTitle( $v ) { $this->bShowTitle = $v; }

		public function modifyGetPost( &$g , &$p ) {
			$id = $this->getId();
			if (isset( $this->aG[$id] )) $this->setValue( $this->aG[$id] );
			if (isset( $this->aP[$id] )) $this->setValue( $this->aP[$id] );
			return parent::modifyGetPost( $g , $p );
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			$this->setParam( "bShowTitle" , $this->bShowTitle );
			$this->setParam( "title" , $this->sTitle );
			$this->setParam( "value" , $this->sValue );
			return parent::render();
		}
	}

?>
