<php>
$_where = array();
$_where['model_id'] = array('eq',[model]);
$_where['status'] = array('eq',1);
$_fields = M('Modelfield') -> where($_where) -> order('sort desc') -> select();
$_d = time().'_';
$_data = json_decode([data],true);
</php>
<foreach name='_fields' item='_vo'>
<php>
$_vo['config'] = htmlspecialchars_decode(str_replace("\r\n","",$_vo['config']));
</php>
<tr>
	<th>{$_vo.text}:</th>
	<td>
		<switch name="_vo.type">

		<case value="bool">
			<input type="radio" name="ext[{$_vo.name}]" value="1" id="{$_d}{$_vo.id}_1" <eq name="_data[$_vo['name']]" value='1'>checked</eq>/><label for="{$_d}{$_vo.id}_1">是</label>
			<input type="radio" name="ext[{$_vo.name}]" value="0" id="{$_d}{$_vo.id}_0" <eq name="_data[$_vo['name']]" value='0'>checked</eq>/><label for="{$_d}{$_vo.id}_0">否</label>
		</case>

		<case value="textbox">
			<script>
				$(function(){
					eval('var config = {{$_vo.config|default=""}};');
					delete config.value;
					$('#{$_d}{$_vo.id}').textbox(config);
				});
			</script>
			<textarea name="ext[{$_vo.name}]" id="{$_d}{$_vo.id}">{$_data[$_vo['name']]}</textarea>
		</case>

		<case value="image">
			<script>
				$(function(){
					MMT.FN.renderPic('#{$_d}{$_vo.id}Picker','#{$_d}{$_vo.id}');
					eval('var config = {{$_vo.config|default=""}};');
					$('#{$_d}{$_vo.id}').textbox(config);
				});
			</script>
			<table class="subform">
				<tr>
					<td class="left">
						<input name="ext[{$_vo.name}]" value="{$_data[$_vo['name']]}" id="{$_d}{$_vo.id}" class="easyui-textbox"/>
					</td>
					<td class="right">
						<div id="{$_d}{$_vo.id}Picker">上传</div>
					</td>
				</tr>
			</table>
		</case>

		<case value="images">
			<script>
				$(function(){
					MMT.FN.renderPics('#{$_d}{$_vo.id}Picker','#{$_d}{$_vo.id}');
					eval('var config = {{$_vo.config|default=""}};');
					$('#{$_d}{$_vo.id}').textbox(config);
				});
			</script>
			<table class="subform">
				<tr>
					<td class="left">
						<textarea name="ext[{$_vo.name}]" id="{$_d}{$_vo.id}" class="easyui-textbox" data-options="multiline:true,height:100">{$_data[$_vo['name']]}</textarea>
					</td>
					<td class="right">
						<div id="{$_d}{$_vo.id}Picker">上传</div>
					</td>
				</tr>
			</table>
		</case>

		<case value="file">
			<script>
				$(function(){
					MMT.FN.renderFile('#{$_d}{$_vo.id}Picker','#{$_d}{$_vo.id}');
					eval('var config = {{$_vo.config|default=""}};');
					$('#{$_d}{$_vo.id}').textbox(config);
				});
			</script>
			<table class="subform">
				<tr>
					<td class="left">
						<input name="ext[{$_vo.name}]" value="{$_data[$_vo['name']]}" id="{$_d}{$_vo.id}" class="easyui-textbox"/>
					</td>
					<td class="right">
						<div id="{$_d}{$_vo.id}Picker">上传</div>
					</td>
				</tr>
			</table>
		</case>

		<case value="files">
			<script>
				$(function(){
					MMT.FN.renderFiles('#{$_d}{$_vo.id}Picker','#{$_d}{$_vo.id}');
					eval('var config = {{$_vo.config|default=""}};');
					$('#{$_d}{$_vo.id}').textbox(config);
				});
			</script>
			<table class="subform">
				<tr>
					<td class="left">
						<textarea name="ext[{$_vo.name}]" id="{$_d}{$_vo.id}" class="easyui-textbox" data-options="multiline:true,height:100">{$_data[$_vo['name']]}</textarea>
					</td>
					<td class="right">
						<div id="{$_d}{$_vo.id}Picker">上传</div>
					</td>
				</tr>
			</table>
		</case>

		<case value="ueditor">
			<script>
				$(function(){
					if (MMT.{$namespace}['Save{$_vo.id}'] == undefined) {
						MMT.{$namespace}['Save{$_vo.id}'] = UE.getEditor('Save{$_vo.id}');
					}else{
						MMT.{$namespace}['Save{$_vo.id}'].destroy();
						MMT.{$namespace}['Save{$_vo.id}'] = UE.getEditor('Save{$_vo.id}');
					};
				});
			</script>
			<textarea name="ext[{$_vo.name}]" id="Save{$_vo.id}">{$_data[$_vo['name']]}</textarea>
		</case>

		<case value="combotree">
			<script>
				$(function(){
					eval('var config = {{$_vo.config|default=""}};');
					delete config.value;
					$('#{$_d}{$_vo.id}').combotree($.extend(true, {
						data:MMT.DATA.error,
						datadict:true,
						editable:false,
					}, config||{}));
				});
			</script>
			<input type="text" name="ext[{$_vo.name}]" value="{$_data[$_vo['name']]}" id="{$_d}{$_vo.id}" />
		</case>

		<case value="numberbox|datebox|datetimebox|timespinner|numberspinner|slider">
			<script>
				$(function(){
					eval('var config = {{$_vo.config|default=""}};');
					delete config.value;
					$('#{$_d}{$_vo.id}').{$_vo.type}(config);
				});
			</script>
			<input name="ext[{$_vo.name}]" value="{$_data[$_vo['name']]}" id="{$_d}{$_vo.id}" />
		</case>

		<default />
			<span style="color:red;">{$_vo.type}表单类型不存在 请联系专业人员</span>
		</switch>
	</td>
</tr>
<notempty name='_vo.instruction'>
<tr>
	<th></th>
	<td class="help">{$_vo.instruction}</td>
</tr>
</notempty>
</foreach>