<?php

	class MemberURL {

		public static function renderURLBase( $type ) {
			$u = "/";
			switch ($GLOBALS["language"]) {
			default:
			case "hu":
				switch ($type) {
				case "agency":$u.="forditoiroda";break;
				case "freelancer":$u.="fordito";break;
				case "parttime":$u.="reszidos-fordito";break;
				}
				break;
			case "en":
				switch ($type) {
				case "agency":$u.="translation-company";break;
				case "freelancer":$u.="freelancer-translator";break;
				case "parttime":$u.="parttime-translator";break;
				}
				break;
			}
			return $u."/";
		}

		public static function renderURLFromMember( $m , $p = array() ) {
			$u = "/";
			switch ($GLOBALS["language"]) {
			default:
			case "hu":
				switch ($m["member_type"]) {
				case "agency":$u.="forditoiroda";break;
				case "freelancer":$u.="fordito";break;
				case "parttime":$u.="reszidos-fordito";break;
				}
				$u.="/".$m["member_aliasname"]."/";
				break;
			case "en":
				switch ($m["member_type"]) {
				case "agency":$u.="translation-company";break;
				case "freelancer":$u.="freelancer-translator";break;
				case "parttime":$u.="parttime-translator";break;
				}

				require_once( $GLOBALS["site_root"] . "/includes/models/ExtendedProperties.inc.php" );
				require_once( $GLOBALS["site_root"] . "/includes/models/Member.inc.php" );
				if (isset( $p["aliasname"] )) {
					$aliasname = $p["aliasname"];
				} else {
					$mm = new MemberModel();
					$epm = new ExtendedPropertiesModel();
					$aliasname = $mm->getMemberExtendedPropertyFromId(
					$m["member_id"], $epm->getEPropIdFromName( "aliasname" ), $GLOBALS["langcode"] );
				}
				$u.="/".$aliasname."/";
				break;
			}
			return $u;
		}
		
		public static function renderAdminURLFromMember( $m , $p = array() ) {
			$u = array();
			$u["mode"]="modify";
			$u["uid"]=$m["member_id"];
			return FNTH_render_url( "/admin/members/edit.php" , $u );
		}
		
		public static function renderMemberAttachmentURL( $member_attachment_id , $p = array() ) {
			switch ($GLOBALS["language"]) {
			default:
			case "hu": return FNTH_render_url( $GLOBALS["site_www"] . "/fordito-csatolmany/" . $member_attachment_id . "/" , $p );
			case "en": return FNTH_render_url( $GLOBALS["site_www"] . "/member-attachment/".$member_attachment_id."/" , $p );
			}
		}
		
	}

?>
