<?php
	FNTH_class( "Textarea" );

	class FrontendTextarea extends FNTHTextarea {
		protected $bShowTitle = false;
		protected $iMaxLength = 0;

		public function setShowTitle( $v ) { $this->bShowTitle = $v; }
		public function setMaxLength( $v ) { $this->iMaxLength = $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] );
			parent::modifyGetPost( $g , $p );
		}
		public function __construct( $id = "FrontendTextarea" , $parent = null ) {
			$this->addMediaDirectory( $GLOBALS["site_root"] , $GLOBALS["site_www"] , "design/rp/","widgets/");
			parent::__construct( $id , $parent );
			$this->setParam("language",$GLOBALS["language"]);
			$this->setAttribute( "class" , "FrontendTextarea" );
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			if ($this->iMaxLength>0) {
				FNTHPage::addUniquePageFullInit( sprintf( "FrontendTextareaMaxLength( '%s' , %d );",
					$this->getId() , $this->iMaxLength ) );
			}
			$this->setParam( "bShowTitle" , $this->bShowTitle );
			return parent::render();
		}
	}

?>
