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

	class FrontendDatetime extends FrontendDate {
		protected $sMinDatetime = null;
		protected $sMaxDatetime = null;

		public function setMinDatetime( $v ) { $this->sMinDatetime = $v; }
		public function setMaxDatetime( $v ) { $this->sMaxDatetime = $v; }

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			$this->setAttribute( "maxlength" , 16 );
			$this->setCSSAttribute( "width" , "105px" );
			$uid = sprintf( "js_%s_init" , $this->getId() );
			if (isset( $this->sMinDatetime ))
				$this->setExtraObjectData( "minDate" , str_replace( "-" , "." , $this->sMinDatetime ) );
			if (isset( $this->sMaxDatetime ))
				$this->setExtraObjectData( "maxDate" , str_replace( "-" , "." , $this->sMaxDatetime ) );

			if (!FNTHPage::getPageFullInit( $uid ))
				FNTHPage::setPageFullInit( $uid ,
					sprintf( "InitFrontendDatetime( '%s',%s,'%s' );\n",
					$this->getId(),
					json_encode( (object)$this->aExtraObj ),	// thereotical php 5.2 fixup
					$this->sExtraEvalData ) );
			return parent::render();
		}

	}

?>
