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

	class MyUserURL {
		public static function renderMyProfileURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/adataim/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/my-profile/" , $p );
			}
		}
		
		public static function renderMyQuoteRequestsURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/ajanlatkereseim/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/my-quote-requests/" , $p );
			}
		}
		
		public static function renderMyActiveQuoteRequestsURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			$p["active"]=1;
			return self::renderMyQuoteRequestsURL($p,$lang);
		}

		public static function renderRegistrationURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/regisztracio/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/registration/" , $p );
			}
		}
		
		public static function renderForgottenPasswordURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/elfelejtett-jelszo/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/forgotten-password/" , $p );
			}
		}
		
		public static function renderForgottenPasswordDoneURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/elfelejtett-jelszo-kuldve/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/forgotten-password-sent/" , $p );
			}
		}

		public static function renderRegistrationSubmittedURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/sikeres-regisztracio/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/successful-registration/" , $p );
			}
		}

		public static function renderRegistrationActivationURL( $p = array() , $lang = "" ) {
			if (!isset( $p["hash"] )) return false;
			if (empty( $lang )) $lang = $GLOBALS["language"];
			$hash = $p["hash"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/reg-aktivalas" , $hash ) );
			case "en": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/reg-activation" , $hash ) );
			}
		}

		public static function renderQuoteRequestActivationURL( $p = array() , $lang = "" ) {
			if (empty( $lang )) $lang = $GLOBALS["language"];
			if (!isset( $p["hash"] )) return false;
			$hash = $p["hash"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/ajanlatkeres-aktivalas" , $hash ) );
			case "en": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/quote-request-activation" , $hash ) );
			}
		}

		public static function renderQuoteRequestCloseURL( $p = array() , $lang = "" ) {
			if (!isset( $p["hash"] )) return false;
			if (empty( $lang )) $lang = $GLOBALS["language"];
			$hash = $p["hash"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/ajanlatkeres-lezaras" , $hash ) );
			case "en": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/quote-request-close" , $hash ) );
			}
		}
		
		public static function renderQuoteRequestRevokeURL( $p = array() , $lang = "" ) {
			if (!isset( $p["hash"] )) return false;
			if (empty( $lang )) $lang = $GLOBALS["language"];
			$hash = $p["hash"];
			switch ($lang) {
			default:
			case "hu": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/ajanlatkeres-visszavonas" , $hash ) );
			case "en": return FNTH_render_url( sprintf( "http://%s%s%s/%s" , $_SERVER["SERVER_NAME"] , $GLOBALS["site_www"] , "/quote-request-revoke" , $hash ) );
			}
		}

		public static function renderFeedbackURL( $p = array() , $lang = "" ) {
			require_once( $GLOBALS["site_root"]."/includes/urlgen/Blueboard.inc.php" );
			if (empty( $lang )) $lang = $GLOBALS["language"];
			/*
			$um = new MyUserModel();
			$user_id = $um->getLoggedInUserId();
			$mm = new MyMemberModel();
			$member_id = $mm->getLoggedInMemberId();
			if ($user_id && $member_id) {
				// member
				if (!$mm->isLoggedinMemberActiveSubscriber()) {
					$p["user_id"]=$user_id;
				} else {
					// aktiv, de lehet, hogy reszidos
					if ($mm->getLoggedinMemberType()=="parttime")
						$p["user_id"]=$user_id;
				}
			} else if ($user_id && !$member_id) {
				// user
				$p["user_id"]=$user_id;
			}
			*/
			return BlueboardURL::renderURL( $p  , false , $lang );
		}
	}

?>
