<?php
/**
 * 插件设置页面
 * http://em.cnzv.cc
 */
!defined('EMLOG_ROOT') && exit('access deined!');
$plugin_storage = Storage::getInstance('yy_top');

function plugin_setting_view() {
	global $plugin_storage;
	$iconTop = $plugin_storage->getValue('iconTop');
	?>
	<script>
		setTimeout(hideActived, 2600);
	</script>
	<?php if(isset($_GET['succ']) && $_GET['succ']==1):?>
	<div class="alert alert-success" role="alert">修改成功</div>
	<?php endif;?>

	<span class="backToTopBtn iconfont <?=$iconTop?:'icon-top1'?>"></span>
	<link href="//at.alicdn.com/t/c/font_4257850_psk8xh442na.css" rel="stylesheet" />
	<style>.backToTopBtn {font-size: 30px;position: fixed;right: 15px;bottom: 30px;background-color: rgb(0 0 0 / 60%);color: white;padding: 12px;line-height: initial;border-radius: 5px;z-index: 9201;</style>
	<h1 class="h3 mb-4 text-gray-800">一键返回顶部（效果在右下角）</h1>
	<form action="plugin.php?plugin=yy_top&action=setting" method="post">
      <div class="card shadow mb-4">
		<div class="card-header py-3">
			<div class="row justify-content-between">
				<div class="form-inline">
					<h5 class="m-2 font-weight-bold">返回顶部图标选择</h5>
				</div>
			</div>
		</div>
		<div class="card-body">
			<div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top1"></h1>
			    <input type="radio" name="icon" value="icon-top1" class="tids align-top" <?php if($iconTop=='icon-top1'){echo 'checked="checked"';}?>/>
			</div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top2"></h1>
			    <input type="radio" name="icon" value="icon-top2" class="tids align-top" <?php if($iconTop=='icon-top2'){echo 'checked="checked"';}?>/>
			</div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top3"></h1>
			    <input type="radio" name="icon" value="icon-top3" class="tids align-top" <?php if($iconTop=='icon-top3'){echo 'checked="checked"';}?>/>
			</div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top4"></h1>
			    <input type="radio" name="icon" value="icon-top4" class="tids align-top" <?php if($iconTop=='icon-top4'){echo 'checked="checked"';}?>/>
			</div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top5"></h1>
			    <input type="radio" name="icon" value="icon-top5" class="tids align-top" <?php if($iconTop=='icon-top5'){echo 'checked="checked"';}?>/>
			</div>
            <div class="badge badge-light m-3 p-2">
			    <h1 style="font-size:2.5rem" class="iconfont icon-top6"></h1>
			    <input type="radio" name="icon" value="icon-top6" class="tids align-top" <?php if($iconTop=='icon-top6'){echo 'checked="checked"';}?>/>
			</div>

		</div>
		<button class="btn btn-success" type="submit">提交</button>
	  </div>

	</form>
	<?php
}
if (!empty($_POST)) {
    
    if($_POST['icon']){
        $iconTop = addslashes($_POST['icon']);
        $plugin_storage->setValue('iconTop', $iconTop, 'string');
        header('Location:./plugin.php?plugin=yy_top&succ=1');
    }

}