<!DOCTYPE html>
<html><?php echo $this->fetch('head.html'); ?>
	<style>
		.h60 {
			height: 60px;
		}
	</style>

	<body>
		<div class="tabs-border">
			<a class="item" href="/moduleadmin.php?m=vote">投票管理</a>
			<a class="item active" href="/moduleadmin.php?m=vote&a=add">投票添加</a>
		</div>
		<div class="main-body">
		<form autocomplete="off" method="post" action="/moduleadmin.php?m=vote&a=save">
			<input type="hidden" name="id" style="display:none;" value="<?php echo $this->_var['data']['id']; ?>">
			<table class="table-add">

				<tr>
					<td  align="right">标题：</td>
					<td><input type="text" class="w98" name="title" id="title" value="<?php echo $this->_var['data']['title']; ?>"></td>
				</tr>
				<tr>
					<td align="right">封面图片：</td>
					<td>
						<div class="js-upload-item">
							<input type="file" id="upa" class="js-upload-file" style="display: none;" />
							<div class="upimg-btn js-upload-btn">+</div>
							<input type="hidden" name="imgurl" class="js-imgurl" value="<?php echo $this->_var['data']['imgurl']; ?>" />
							<div class="js-imgbox">
								<?php if ($this->_var['data']['imgurl']): ?>
								<img src="<?php echo images_site($this->_var['data']['imgurl']); ?>.100x100.jpg">
								<?php endif; ?>
							</div>
						</div>
					</td>
				</tr>
				<tr>
					<td>开始时间：</td>
					<td><input type='text' name='starttime' id='starttime' value='<?php if ($this->_var['data']): ?><?php echo date("Y-m-d H:m:s",$this->_var['data']['starttime']); ?><?php endif; ?>'
						 ></td>
				</tr>
				<tr>
					<td>结束时间：</td>
					<td><input type='text' name='endtime' id='endtime' value='<?php if ($this->_var['data']): ?><?php echo date("Y-m-d H:m:s",$this->_var['data']['endtime']); ?><?php endif; ?>' ></td>
				</tr>
				<tr>
					<td>活动类型：</td>
					<td>

						<?php $_from = $this->_var['typelist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('k', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['c']):
?>

						<input type="radio" class="js-typeid" name="typeid" value="<?php echo $this->_var['k']; ?>" <?php if ($this->_var['k'] == $this->_var['data']['typeid']): ?> checked<?php endif; ?>> <?php echo $this->_var['c']; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </td> </tr>
						 <tr>
					<td>模板</td>
					<td>
						<input type="text" id="tpl" name="tpl" value="<?php echo $this->_var['data']['tpl']; ?>" />
					</td>
				</tr>
				<tr>
					<td>投票类型：</td>
					<td>
						<input type="radio" name="gotype" value="1" <?php if ($this->_var['data']['gotype'] == 1): ?> checked<?php endif; ?>>按总数 <input type="radio" name="gotype"
						 value="2" <?php if ($this->_var['data']['gotype'] != 1): ?> checked<?php endif; ?>> 按天 </td> </tr> <tr>
					<td>投票次数：</td>
					<td>
						<input type="text" name="gonum" class="w100" value="<?php echo $this->_var['data']['gonum']; ?>">
					</td>
				</tr>
				<tr>
					<td>参加人数</td>
					<td>
						<input type="text" name="join_num" value="<?php echo $this->_var['data']['join_num']; ?>" />
					</td>
				</tr>
				<tr>
					<td>状态：</td>
					<td><input type="radio" name="status" value="2" <?php if ($this->_var['data']['status'] != 2): ?> checked="checked" <?php endif; ?> />隐藏 &nbsp;
						<input type="radio" name="status" value="1" <?php if ($this->_var['data']['status'] == 1): ?> checked="checked" <?php endif; ?> />显示</td>
				</tr>
				<tr>
					<td align="right">活动介绍：</td>
					<td><textarea class="w98 h60" type="text" name="description" id="description"><?php echo $this->_var['data']['description']; ?></textarea></td>
				</tr>

				<tr>
					<td align="right">奖品介绍：</td>
					<td>
						<script name="award" id="award" style="height:300px;" type="text/html"><?php echo $this->_var['data']['award']; ?></script>

					</td>
				</tr>

				<tr>
					<td align="right">参与规则：</td>
					<td>
						<script name="ruledesc" id="ruledesc" style="height:300px;" type="text/html"><?php echo $this->_var['data']['ruledesc']; ?></script>
					</td>
				</tr>
				<?php if ($this->_var['data']): ?>
				<tr>
					<td>发布时间：</td>
					<td><?php echo date("Y-m-d H:m",$this->_var['data']['dateline']); ?></td>
				</tr><?php endif; ?>
				<tr>
					<td align="right">活动详情</td>
					<td>
						<script name="content" id="content" style="height:300px;" type="text/html"><?php echo $this->_var['data']['content']; ?></script>
					</td>
				</tr>
				 
			</table>
			<div class="btn-row-submit js-submit" >保存</div>
		</form>
		</div>
		<?php echo $this->fetch('footer.html'); ?>
		<script src="/static/admin/js/upload.js"></script>
		<script src="/plugin/laydate/laydate.js"></script>
		<script>
			laydate.render({
				elem:"#starttime",
				type: 'datetime'
			})
			laydate.render({
				elem:"#endtime",
				type: 'datetime'
			})
			$(document).on("click",".js-typeid",function(){
				var v=$(this).val();
				var tpl="";
				console.log(v);
				switch(v){
					case "1":
						tpl="picture/";
						break;
					case "2":
						tpl="article/";
						break;
					case "3":
						tpl="audio/";
						 
						break;
					case "4":
						tpl="video/";
						break;
				}
				$("#tpl").val(tpl);
			})
		</script>
		<?php loadEditor();?>
		<script>
			var editor = UE.getEditor('content', options);
			var editor2 = UE.getEditor('award', options);
			var e3 = UE.getEditor('ruledesc', options);
		</script>

	</body>

</html>
