<?php
	require_once( $GLOBALS["site_root"]."/includes/pages/DefaultFrontend.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/widgets/JobQuotePane.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/MyMember.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/Job.inc.php" );

	class JobQuotePage extends DefaultFrontend {
		protected $bLoggedin;
		protected $bActiveSubscriber;
		protected $bAvailable;
		protected $oJobQuotePane;

		public function __construct( $id = "JobQuotePage" , $parent = null , $pagetype = "translation_jobs"  ) {
			parent::__construct( $id , $parent , $pagetype );
		}

		public function modifyGetPost( &$g , &$p ) {
			$this->job_id = (isset( $g["job_id"] )) ? $g["job_id"] : false;
			$this->mmm = new MyMemberModel();
			$this->jm = new JobModel();
			$this->bLoggedin = $this->mmm->isUserLoggedin();
			$this->bActiveSubscriber = $this->mmm->isLoggedinMemberActiveSubscriber();
			$this->bAvailable = $this->jm->isJobQuoteAvailableForUser(
				$this->job_id ,
				$this->mmm->getLoggedinUserId() );
		
			if ($this->bAvailable) {
				$this->bFullscreen = true;
				$this->sExtraClass = "fullscr";
			}

			$this->oJobQuotePane = new JobQuotePane( "content_widget" , $this );
			$this->oJobQuotePane->setJobId( $this->job_id );
			$this->oJobQuotePane->setLoggedin( $this->bLoggedin );
			$this->oJobQuotePane->setActiveSubscriber( $this->bActiveSubscriber );
			$this->oJobQuotePane->setAvailable( $this->bAvailable );
			$retval = parent::modifyGetPost( $g , $p );
			return $retval;
		}
	}

?>
