<?php

/*
  PHP version 5
  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM
  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖
  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220
*/


use application\ESPCMS_Core;
use inc_application\link\MemberLink;
use inc_application\link\OrderLink;
use inc_application\link\ForumLink;
use inc_application\link\CouponLink;
use inc_application\link\EnquiryLink;

class lib_memmenu {

	public static function call_memmenu($parameter, $filename = 'member_menu', $outHTML = null) {
		$espcms_lib_template = espcms_web_template();
		$espcms_lib_template->libfile = true;
		$para = espcms_array_getvalue($parameter);
		$member_link = MemberLink::get_link();
		$order_app_config = ESPCMS_Core::get_app_config('order', false);
		if ($order_app_config['isetup'] && $order_app_config['isopen']) {
			$order_link = OrderLink::order_member_link();
			$espcms_lib_template->into('order_link', $order_link);
		}
		$coupon_app_config = ESPCMS_Core::get_app_config('coupon', false);
		if ($coupon_app_config['isetup'] && $coupon_app_config['isopen']) {
			$coupon_link = CouponLink::get_coupon_link();
			$espcms_lib_template->into('coupon_link', $coupon_link);
			$uncoupon_link = CouponLink::get_uncoupon_link();
			$espcms_lib_template->into('uncoupon_link', $uncoupon_link);
			$get_coupon_link = CouponLink::get_hovecoupon_link();
			$espcms_lib_template->into('get_coupon_link', $get_coupon_link);
		}
		$enquiry_app_config = ESPCMS_Core::get_app_config('enquiry', false);
		if ($enquiry_app_config['isetup'] && $enquiry_app_config['isopen']) {
			$enquiry_link = EnquiryLink::enquiry_member_link();
			$espcms_lib_template->into('enquiry_link', $enquiry_link);
		}
		$bbs_app_config = ESPCMS_Core::get_app_config('bbsemanage', false);
		if ($bbs_app_config['isetup'] && $bbs_app_config['isopen']) {
			$bbs_link = ForumLink::bbs_member_link();
			$espcms_lib_template->into('bbs_link', $bbs_link);
		}
		$espcms_lib_template->into('member_link', $member_link);
		if (!empty($outHTML)) {
			$output = $espcms_lib_template->fetch(null, null, $outHTML);
		} else {
			$output = $espcms_lib_template->fetch('lib/' . $filename);
		}
		return $output;
	}

}
