<?php
if (!defined('ROOT')) exit ;
$uid=session('user_auth.id');
$mycss=M('mycss')->where(array('uid'=>$uid))->find();
if(IS_POST){
	$m=D('pub/mycss');
	$data=$m->create();
    if(empty($mycss)){
		$id=$m->add();
		$mycss=$m->find($id);
    }else{
    	$data=array(
			'index'=>$data['index'],
			'download'=>$data['download'],
			'id'=>$mycss['id']
		);
		$m->save($data);
		$mycss=$m->find($mycss['id']);
    }
}
?>
<!DOCTYPE html>
<html>

	<head>
		<title>目录管理</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
		include 'Inc_files.php';
		?>
		<style type="text/css">
		#list_style .widget{ padding: 15px;}
		</style>
	</head>

	<body>
		<div class="am-g tpl-g">
			<?php include 'Inc_head.php'
			?>
			<!-- 侧边导航栏 -->
			<?php
			include 'Inc_left.php';
			?>
			<!-- 内容区域 -->
			<div class="tpl-content-wrapper">
				<div class="row-content am-cf">
					<div class="row">
						<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
							<div class="widget am-cf">
								<div class="widget-head am-cf">
									<div class="widget-title  am-cf">
										<a href="javascript:;" id="folder_root">自定义模版</a> 
									</div>
								</div>
								<div class="widget-body am-cf">
									<form class="am-form" method="post" action="/V/mod">
										<input type="hidden" name="model_id" value="48" />
										<input type="hidden" name="id" value="<?php echo I('id') ;?>" />
										<input type="hidden" name="etime" value="<?php echo I('id') ;?>" />
										<div class="am-form-group">
									    	<label for="doc-ta-1">主页模版</label>
									    	<textarea name="index" rows="10"><?php echo $modval['index'];?></textarea>
									    </div>
									    <div class="am-form-group">
									    	<label for="doc-ta-1">下载页模版</label>
									    	<textarea name="download" rows="10"><?php echo $modval['download'];?></textarea>
									    </div>
									    <div class="am-form-group">
									    	<label for="doc-ta-1">wap版主页模版</label>
									    	<textarea name="index_wap" rows="10"><?php echo $modval['index_wap'];?></textarea>
									    </div>
									    <div class="am-form-group">
									    	<label for="doc-ta-1">wap版下载页模版</label>
									    	<textarea name="download_wap" rows="10"><?php echo $modval['download_wap'];?></textarea>
									    </div>
									    <div class="am-form-group tc"> 
									    	<button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
									    </div>
								   	</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php
		include 'Inc_files_boot.php';
		?>
		<script src="<?php echo C('TMPL_PARSE_STRING.__TPL__'); ?>/assets/js/theme.js"></script>
		<script type="text/javascript">
			jQuery(document).ready(function($){ 
			});
		</script>
		
	</body>

</html>