<?php
	require_once "pageBase.php";
	require_once "dal/memberDAL.php";

	class _member1 extends pageBase {
		public function load() {
			if ($this->registry->isCustomer == 0) {
				header("Location: /404.php");
				exit();
			}

			if (isset($_SESSION["member_id"]) && $_SESSION["member_id"] != "") {
				$this->loadData();
			} else {
				$this->locationHref = "member_login.html";
			}
			
			parent::loadTemplateFile("templates/{$this->registry->webTemplates}/member1.html");
			parent::load();
		}

		public function loadData() {
			//橫幅廣告
			$this->picturetype = "130";

			/* 會員資料 */
			$dal = new memberDAL();
			$dal->MemberID = $_SESSION["member_id"];
			$dal->loadRecord();
			$gender = $dal->MemberGender ? "先生" : "小姐";
			parent::addParameter("LevelName", $dal->LevelName);
			parent::addParameter("MemberName", $dal->MemberName);
			parent::addParameter("MemberGender", $gender);
			parent::addParameter("MemberMobile", $dal->MemberMobile);
			parent::addParameter("MemberPhone", $dal->MemberPhone);

			//父類方法
			parent::loadData();
		}
	}

	$page = new _member1();
	$page->load();
	$page->render();
?>