<?php
	require_once( $GLOBALS["site_root"] . "/includes/widgets/FrontendTextbox.inc.php" );
	require_once( $GLOBALS["site_root"] . "/includes/models/User.inc.php" );
	require_once( $GLOBALS["site_root"] . "/includes/models/MyUser.inc.php" );

	class QuoteRequestName extends FrontendTextbox {
		protected $bLoggedIn = false;

		public function __construct( $id , $parent = null ) {
			parent::__construct( $id , $parent );
			$this->setAttribute( "maxlength" , 64 );
		}
		
		public function render() {
			if ($this->sRendered) return $this->sRendered;
			$myuser = new MyUserModel();
			$this->bLoggedIn = $myuser->isUserLoggedin();
			$this->setParam( "bLoggedIn" , $this->bLoggedIn );
			$um = new UserModel();
			if ($this->bLoggedIn) {
				$user = $um->getUserFromUserId( $myuser->getLoggedinUserId() );
				$this->setValue( $user["user_name"] );
			}
			return parent::render();
		}
	}
?>
