<?php
	require_once "pageBase.php";
	require_once "../dal/userDAL.php";
	require_once "../bin/web/repeater.php";
	require_once "../bin/system/utility.php";
	class _myLineJoin extends pageBase {
		public function load() {
			$this->limitID = "70";
			if (!parent::chkUserLimit()) {
				$this->alertMsg = "您沒有使用此頁面的權限!如有疑問請洽主管理者!";
				$this->locationHref = "index.php";
			} else {
				$this->loadData();
			}
			parent::loadTemplateFile(dirname(__FILE__) . "/templates/myLineJoin.html");
			parent::load();
		}
		
		public function loadData() {
			$dal = new userDAL();
			$dal->UserID = parent::getCurrentUserID();
			$dal->loadRecord();

			$note_text = "";
			$btn_html = "";

			if ($dal->UserID > "1") {
				if ($dal->LineUID != "") {
					$note_text = <<<HTML
					<h4 class="mt_5 d_flex f_aitems_end"><svg class="mr_1 fa svg_stroke_green" id="line_check"><use xlink:href="svg/icons.svg#check"></use></svg>綁定成功</h4>
					HTML;
					$btn_html = <<<HTML
					<a class="mr_2 btn btn_red" data-action="delItem" href="javascript:void(0);" data-id="{$dal->UserID}">移除</a>
					HTML;
				} else {
					$btn_html = "<a class=\"mr_2 btn btn_info\" href=\"myLineJoinSend.php\">立即前往綁定</a>";
				}
			} else {
				$note_text = <<<HTML
				<h4 class="mt_5 txt_red">為了維護資料安全，超級管理員不可以使用Line登入!</h4>
				HTML;
			}
			
            parent::addParameter("note_text", $note_text);
            parent::addParameter("btn_html", $btn_html);

			parent::loadData();
		}
	}

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