<?php
	require_once( $GLOBALS["site_root"]."/includes/pages/DefaultFrontend.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/widgets/CouponActivatePane.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/widgets/SystemArticle.inc.php" );
	
	require_once( $GLOBALS["site_root"]."/includes/models/MyUser.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/MyMember.inc.php" );
	
	class CouponActivatePage extends DefaultFrontend {
		protected $oCouponActivatePane;

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

		public function modifyGetPost( &$g , &$p ) {
			$retval = parent::modifyGetPost( $g , $p );
			$this->myuser_model = new MyUserModel();
			$this->mymember_model = new MyMemberModel();
			if (!$this->myuser_model->isUserLoggedIn()) {
				$this->oCouponActivatePane = new SystemArticle( "content_widget" , $this , "sys_error_user_has_to_login" );
			} else if (!$this->mymember_model->isMemberLoggedIn()) {
				$this->oCouponActivatePane = new SystemArticle( "content_widget" , $this , "sys_error_user_has_to_be_a_member" );
			} else {
				$this->oCouponActivatePane = new CouponActivatePane( "content_widget" , $this );
			}
			return $retval;
		}

	}

?>
