<?php /* Smarty version 2.6.17, created on 2018-05-17 18:24:33
         compiled from admin/activity/page_create.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'admin/activity/page_create.html', 81, false),array('modifier', 'in_array', 'admin/activity/page_create.html', 161, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<style>
.set-nav {
	margin: 0 auto;
}
.set-nav-hr {
	background-color: #ddd;
    height: 1px;
    position: relative;
}
.form-group label {
	font-weight: 600;
}
.checkbox-inline, .radio-inline {
	font-weight: 400!important;
}
.rowlabel {
	font-weight: 300!important;
}
.music_play_hide {
	display:none;
}
</style>

<div id="activity_container">

<form id="activity_form">
<div class="activity_center">
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<?php if (! $this->_tpl_vars['platformList']): ?>
		请先创建一个列表。进入<a href="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
/?c=Admin_Platform_index&a=PageList">平台列表</a>
	<?php else: ?>
	<div class="form-group">
		<label>标题:</label>
		<input name="events_name" type="text" class="form-control">
	</div>
	
	<div class="form-group">
		<label>活动类型:</label>
		<div>
		<?php if (! $this->_tpl_vars['thisType']): ?>
			<?php $_from = $this->_tpl_vars['typeData']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['typeid'] => $this->_tpl_vars['type']):
?>
			<label class="radio-inline"><input name="type" type="radio" value="<?php echo $this->_tpl_vars['typeid']; ?>
"> <?php echo $this->_tpl_vars['type']['desc']; ?>
</label>
			<?php endforeach; endif; unset($_from); ?>
		<?php else: ?>
			<?php $_from = $this->_tpl_vars['typeData']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['typeid'] => $this->_tpl_vars['type']):
?>
			<?php if ($this->_tpl_vars['thisType'] == $this->_tpl_vars['typeid']): ?>
			<label class="radio-inline"><input name="type" type="radio" value="<?php echo $this->_tpl_vars['typeid']; ?>
" checked> <?php echo $this->_tpl_vars['type']['desc']; ?>
</label>
			<?php else: ?>
			<label class="radio-inline"><input name="type" type="radio" value="<?php echo $this->_tpl_vars['typeid']; ?>
" style="color:#ccc;" disabled> <?php echo $this->_tpl_vars['type']['desc']; ?>
</label>
			<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		<?php endif; ?>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label">列表默认图<small class="text-danger">(JPG、PNG,640x320,小于60k)</small></label>
		<div>
			<img id="img_url_tag" src="http://placehold.it/320x160&text=640x320" style="width:200px;" class="img-thumbnail">
			<input id="img_url_input" name="img_url" type="hidden" value="">
			<input id="image_upload" type="button" value="选择图片" >
		</div>
	</div>
	<?php if ($this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] != 'TYPE_EVENTS_ARTICLE'): ?>
	<div class="form-group">
		<label class="control-label">开始时间:</label>
		<input name="begin_time" type="text" class="form-control" style="max-width:250px;min-width:200px;">
	</div>
	<div class="form-group">
		<label class="control-label">结束时间:</label>
		<input name="end_time" type="text" class="form-control" style="max-width:250px;min-width:200px;">
	</div>
	<?php endif; ?>
	<div class="form-group">
		<label class="control-label">发布到哪些列表</label>
		<div>
			<?php if (count($this->_tpl_vars['platformList']) == 1): ?>
			<?php $_from = $this->_tpl_vars['platformList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['platfrom']):
?>
			<label class="checkbox-inline">
				<input name="platform_ids[]" type="checkbox" value="<?php echo $this->_tpl_vars['platfrom']['id']; ?>
" checked> <?php echo $this->_tpl_vars['platfrom']['name']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
			<?php else: ?>
			<?php $_from = $this->_tpl_vars['platformList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['platfrom']):
?>
			<label class="checkbox-inline">
				<input name="platform_ids[]" type="checkbox" value="<?php echo $this->_tpl_vars['platfrom']['id']; ?>
"> <?php echo $this->_tpl_vars['platfrom']['name']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
			<?php endif; ?>
		</div>
		<div class="note">注:创建后不可修改</div>
	</div>
	<?php if ($this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] == 'TYPE_EVENTS_OTHER'): ?>
	<div class="form-group">
		<label>跳转URL:</label>
		<input name="other_url" type="text" class="form-control">
	</div>
	<?php endif; ?>

	<div class="form-group">
		<label class="control-label">选择分类</label>
		<div>
			<select id="cotegory_id" name="category_id">
				<option value="0" selected>选择分类名称</option>
			<?php $_from = $this->_tpl_vars['categoryList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['cate']):
?>
			<option value="<?php echo $this->_tpl_vars['cate']['id']; ?>
" <?php if ($this->_tpl_vars['cate']['id'] == $this->_tpl_vars['eventData']['category_id']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['cate']['name']; ?>
</option>
			<?php endforeach; endif; unset($_from); ?>
			</select>
		</div>
	</div>

	<div class="form-group">
		<label class="control-label">是否推荐到焦点图</label>
		<div>
			<?php $_from = $this->_tpl_vars['focusDisplay']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['info']):
?>
			<label class="radio-inline">
				<input name="focus_display" type="radio" value="<?php echo $this->_tpl_vars['key']; ?>
" <?php if ($this->_tpl_vars['eventData']['focus_display'] == $this->_tpl_vars['key']): ?>checked<?php endif; ?> > <?php echo $this->_tpl_vars['info']['desc']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
		</div>	
	</div>

	<div class="form-group">
		<label class="control-label">是否置顶</label>
		<div>
			<?php $_from = $this->_tpl_vars['topDisplay']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['info']):
?>
			<label class="radio-inline">
				<input name="top_display" type="radio" value="<?php echo $this->_tpl_vars['key']; ?>
" <?php if ($this->_tpl_vars['eventData']['top_display'] == $this->_tpl_vars['key']): ?>checked<?php endif; ?> > <?php echo $this->_tpl_vars['info']['desc']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
		</div>	
	</div>
	
	<div class="form-group">
		<label class="control-label">是否用户登录</label>
		<div>
			<?php $_from = $this->_tpl_vars['authorize']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['authid'] => $this->_tpl_vars['info']):
?>
			<label class="radio-inline">
				<input name="authorize" type="radio" value="<?php echo $this->_tpl_vars['authid']; ?>
"> <?php echo $this->_tpl_vars['info']['desc']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
		</div>	
	</div>
	
	<div class="form-group">
		<label class="control-label">是否在列表中出现</label>
		<div>
			<?php $_from = $this->_tpl_vars['listDisplay']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['info']):
?>
			<label class="radio-inline">
				<input name="list_display" type="radio" value="<?php echo $this->_tpl_vars['key']; ?>
"> <?php echo $this->_tpl_vars['info']['desc']; ?>

			</label>
			<?php endforeach; endif; unset($_from); ?>
		</div>	
	</div>
	
	
	<?php if (! ((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['weixinFormNotType']) : in_array($_tmp, $this->_tpl_vars['weixinFormNotType']))): ?>
	<div class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">设置微信分享</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<div class="form-group">
					<label class="control-label rowlabel">分享用图:<small class="text-danger">JPG、PNG,200*200,小于20k</small></label>
					<div>
						<img id="share_image_tag" src="http://placehold.it/200&text=200x200" style="width:150px;" class="img-thumbnail">
						<input id="share_image_input" name=wx_img_url type="hidden" value="">
						<input id="share_image_upload" type="button" value="选择图片" >
					</div>
				</div>
				<div class="row">
					<div class="col-md-6">
						<div class="form-group">
							<label class="control-label rowlabel">标题:<small class="text-danger">小于24个字</small></label>
							<input name="weixinShare_title" type="text" class="form-control">
						</div>
						<div class="form-group">
							<label class="control-label rowlabel">分享内容:<small class="text-danger">小于36个字</small></label>
							<input name="weixinShare_content" type="text" class="form-control">
						</div>
						<div class="form-group">
							<label class="control-label rowlabel">用户分享后跳转地址:</label>
							<input name="weixinShare_jump_url" type="text" class="form-control">
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<?php endif; ?>
	<?php if ($this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] != 'TYPE_EVENTS_ARTICLE' && $this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] != 'TYPE_EVENTS_CUT_SCREEN' && $this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] != 'TYPE_EVENTS_OTHER'): ?>
	<div  class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">设置参与规则</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<div class="row">
					<div class="col-md-3">
						<p>允许每天用户参与次数:</p>
						<input name="participation_user_num" type="text" class="form-control" value="0" style="max-width:;">
					</div>
					<div class="col-md-3">
						<p>允许每天IP参与次数:</p>
						<input name="participation_ip_num" type="text" class="form-control" value="0" style="max-width:;">
					</div>
					<div class="col-md-3">
						<p>允许用户参与次数:</p>
						<input type="text" name="participation_user_all_num" class="form-control" value="0" style="max-width:;">
					</div>
					<?php if ($this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] == 'TYPE_EVENTS_TURNTABLE'): ?>
					<div class="col-md-3">
						<p>允许用户获奖次数:</p>
						<input type="text" name="winning_user_num" class="form-control" value="0" style="max-width:;">
					</div>
					<?php endif; ?>
				</div>
			</div>
		</div>
	</div>
	<?php endif; ?>
	<?php if (((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['cutDirectionFormNotType']) : in_array($_tmp, $this->_tpl_vars['cutDirectionFormNotType']))): ?>
	<div  class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">切屏方向</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<div>
					<label class="radio-inline">
						<input name="cut_fx" type="radio" value="fadeInUp" <?php if ($this->_tpl_vars['eventData']['cut_fx'] == 'fadeInUp'): ?>checked<?php endif; ?> > 从下向上翻页
					</label>
					<label class="checkbox-inline">
						<input name="cut_fx" type="radio" value="fadeInRight" <?php if ($this->_tpl_vars['eventData']['cut_fx'] == 'fadeInRight'): ?>checked<?php endif; ?> > 从右向左翻页
					</label>
				</div>
				<div class='note'>调整切屏方向,将改变切屏方式及部分内容显示的效果,一旦选定,尽量不要修改</div>
			</div>
		</div>
	</div>
	<?php endif; ?>
	
	<?php if (((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['musicFormNotType']) : in_array($_tmp, $this->_tpl_vars['musicFormNotType']))): ?>		
	<div  class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">专题音乐设置</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<div>
					<a href="javascript:;" class="music_play_or_pause music_play_hide button button-caution button-circle button-tiny" data-type="play">播</a> 
					<input id="music_input" name="music_url" type="hidden" value="">
					<input id="music_upload" type="button" value="选择音乐" >
				</div>
				<div>
				<p></p>
				<span class="">音乐图标放置:</span>
				<?php $_from = $this->_tpl_vars['getMusicPosition']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['posid'] => $this->_tpl_vars['info']):
?>
				<label class="radio-inline">
					<input name="music_position" type="radio" value="<?php echo $this->_tpl_vars['posid']; ?>
"> <?php echo $this->_tpl_vars['info']['desc']; ?>

				</label>
				<?php endforeach; endif; unset($_from); ?>
				</div>
			</div>
			<div>目前只支持MP3格式,小于20k</div>
		</div>
	</div>
	
	<div  class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">加载动画设置</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<div class="row">
					<div class="col-md-3">
						<p>加载背景色:</p>
						<input id="loading_bg_input" name="loading_bg_color" type="text" class="form-control" value="#f8f7f5">
					</div>
					<div class="col-md-3">
						<p>加载动画、文本颜色:</p>
						<input id="loading_text_input" name="loading_text_color" type="text" class="form-control" value="#999999">
					</div>
				</div>
			</div>
		</div>
	</div>
	<?php endif; ?>
	<a id="activity_submit" href="javascript:;" class="button button-3d button-primary button-rounded"><i class="fa fa-refresh fa-spin" style="display:none;"></i> 创建活动</a>
	<?php endif; ?>
</div>

<div style="clear:both;"></div>
</form>
</div>

<?php if (((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['musicFormNotType']) : in_array($_tmp, $this->_tpl_vars['musicFormNotType']))): ?>
<script src="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
/public/static/js/jquery.minicolors.js"></script>
<link rel="stylesheet" href="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
/public/static/js/jquery.minicolors.css">
<?php endif; ?>

<script>
KISSY.use('node, io, jquery, gallery/datetimepicker/2.0.0/index, gallery/xplayer/2.1.0/index', function (S, Node, IO, jQuery, Datetimepicker, Xplayer) {
	var $ = S.all;
	
	//日期
    new Datetimepicker({
        start : 'input[name=begin_time]'
    });
 	//日期
    new Datetimepicker({
        start : 'input[name=end_time]'
    });
 	
    var XiamiPlay = new Xplayer({
        "autoplay": false
    });
    <?php if (((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['musicFormNotType']) : in_array($_tmp, $this->_tpl_vars['musicFormNotType']))): ?>
	//选择音乐
    KindEditor.ready(function(K) {
    	var uploadbutton = K.uploadbutton({
    		button : K('#music_upload')[0],
    		fieldName : 'imgFile',
    		url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=mp3',
    		afterUpload : function(data) {
    			if (data.error === 0) {
    				var url = K.formatUrl(data.url, 'absolute');
    				K('#music_input').val(data.url);
    				$(".music_play_or_pause").removeClass('music_play_hide');
    				XiamiPlay.load({
    				    'url' : data.url,
    				});
    			} else {
    				alert(data.message);
    			}
    		},
    		afterError : function(str) {
    			alert('自定义错误信息: ' + str);
    		}
    	});
    	uploadbutton.fileBox.change(function(e) {
    		uploadbutton.submit();
    	});
    });
  	
    $(".music_play_or_pause").on("click", function() {
    	if ($(this).attr('data-type') == 'play') {
    		XiamiPlay.play();
    		$(this).attr('data-type', 'pause').text('停');
    	} else {
    		XiamiPlay.pause();
    		$(this).attr('data-type', 'play').text('播');
    	}
    });
    <?php endif; ?>
    
    var activity_submit_status = false; //按钮状态
    function submit_button_active() {
    	activity_submit_status = true;
    	$("#activity_submit").addClass('active').all('i').show();
    }
    function submit_button_default() {
    	activity_submit_status = false;
    	$("#activity_submit").removeClass('active').all('i').hide();
    }
    
    $("#activity_submit").on('click', function () {
    	if (activity_submit_status) {
    		return false;
    	}
    	submit_button_active();
    	
    	//表单验证
    	var events_name = S.trim($("input[name=events_name]").val());
    	if (!events_name) {
    		alert('请填写活动标题');
    		submit_button_default();
    		return false;
    	}
    	
    	var img_url = $("input[name=img_url]").val();
    	if (!img_url) {
    		alert('请选择列表默认图片');
    		submit_button_default();
    		return false;
    	}
    	
    	var type = $("input[name=type]:checked").val();
    	if (type <= 0) {
    		alert('请选择活动类型');
    		submit_button_default();
    		return false;
    	}
    	
    	<?php if ($this->_tpl_vars['typeData'][$this->_tpl_vars['thisType']]['kw'] != 'TYPE_EVENTS_ARTICLE'): ?>
    	var begin_time = $("input[name=begin_time]").val();
    	var end_time = $("input[name=end_time]").val();
    	if (!begin_time || !end_time) {
    		alert('请设置活动时间');
    		submit_button_default();
    		return false;
    	}
    	<?php endif; ?>
    	
    	formData = IO.serialize("#activity_form");
    	new IO({
			type: "post"
			, url: VG.conf.root_domain + '/?c=Admin_Activity_SetBasics&a=ReqCreate'
			, data: formData
			, success: function (data) {
				if (data.ok) { //ok
					var url = data.msg;
					location.href = url;
				} else {
					alert('操作失败,原因:'+data.msg);
				}
				return false;
			}
			, error: function (NULL, textStatus) {
				alert("请求服务器失败,原因:"+textStatus);
			}
			, dataType: "json"
		});
    });
});

//设置微信分享
KindEditor.ready(function(K) {
	var uploadbutton = K.uploadbutton({
		button : K('#share_image_upload')[0],
		fieldName : 'imgFile',
		url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
		afterUpload : function(data) {
			if (data.error === 0) {
				var url = K.formatUrl(data.url, 'absolute');
				K('#share_image_input').val(data.url);
				K('#share_image_tag').attr('src', data.url);
			} else {
				alert(data.message);
			}
		},
		afterError : function(str) {
			alert('自定义错误信息: ' + str);
		}
	});
	uploadbutton.fileBox.change(function(e) {
		uploadbutton.submit();
	});
});

//列表默认图
KindEditor.ready(function(K) {
	var uploadbutton = K.uploadbutton({
		button : K('#image_upload')[0],
		fieldName : 'imgFile',
		url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
		afterUpload : function(data) {
			if (data.error === 0) {
				var url = K.formatUrl(data.url, 'absolute');
				K('#img_url_input').val(data.url);
				K('#img_url_tag').attr('src', data.url);
			} else {
				alert(data.message);
			}
		},
		afterError : function(str) {
			alert('自定义错误信息: ' + str);
		}
	});
	uploadbutton.fileBox.change(function(e) {
		uploadbutton.submit();
	});
});

<?php if (((is_array($_tmp=$this->_tpl_vars['thisType'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['musicFormNotType']) : in_array($_tmp, $this->_tpl_vars['musicFormNotType']))): ?>
$("#loading_bg_input").minicolors({
	defaultValue: '<?php echo $this->_tpl_vars['eventData']['loading_bg_color']; ?>
'
});
$("#loading_text_input").minicolors({
	defaultValue: '<?php echo $this->_tpl_vars['eventData']['loading_text_color']; ?>
'
});
<?php endif; ?>
</script>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>